]> git.lizzy.rs Git - mt_rudp.git/blob - src/lib.rs
Rework structure
[mt_rudp.git] / src / lib.rs
1 #![feature(cursor_remaining)]
2 #![feature(hash_drain_filter)]
3 #![feature(once_cell)]
4 mod client;
5 mod common;
6 mod error;
7 mod recv;
8 mod send;
9 mod share;
10
11 pub use client::*;
12 pub use common::*;
13 pub use error::*;
14 use recv::*;
15 pub use send::*;
16 pub use share::*;
17 pub use ticker_mod::*;
18
19 mod ticker_mod {
20     #[macro_export]
21     macro_rules! ticker {
22                 ($duration:expr, $close:expr, $body:block) => {
23                         let mut interval = tokio::time::interval($duration);
24
25                         while tokio::select!{
26                                 _ = interval.tick() => true,
27                                 _ = $close.changed() => false,
28                         } $body
29                 };
30         }
31 }