mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-07 04:53:44 +02:00
added pub option
This commit is contained in:
parent
984782d779
commit
c2125db444
1 changed files with 25 additions and 1 deletions
|
@ -348,7 +348,7 @@ unsafe impl<T, OriginPool: StaticPool<T, L>, const L: usize> Sync for PoolArcSwa
|
|||
/// ```
|
||||
/// use zerotier_utils::arc_pool::{Pool, StaticPool, static_pool};
|
||||
///
|
||||
/// static_pool!(StaticPool MyPools {
|
||||
/// static_pool!(pub StaticPool MyPools {
|
||||
/// Pool<u32>, Pool<&u32, 12>
|
||||
/// });
|
||||
///
|
||||
|
@ -384,6 +384,30 @@ macro_rules! __static_pool__ {
|
|||
}
|
||||
)*
|
||||
};
|
||||
(pub $m:ident $s:ident { $($($p:ident)::+<$t:ty$(, $l:tt)?>),+ $(,)?}) => {
|
||||
pub struct $s {}
|
||||
$(
|
||||
impl $m<$t$(, $l)?> for $s {
|
||||
#[inline(always)]
|
||||
unsafe fn get_static_pool() -> *const () {
|
||||
static POOL: $($p)::+<$t$(, $l)?> = $($p)::+::new();
|
||||
(&POOL as *const $($p)::+<$t$(, $l)?>).cast()
|
||||
}
|
||||
}
|
||||
)*
|
||||
};
|
||||
(pub $m:ident::$n:ident $s:ident { $($($p:ident)::+<$t:ty$(, $l:tt)?>),+ $(,)?}) => {
|
||||
pub struct $s {}
|
||||
$(
|
||||
impl $m::$n<$t$(, $l)?> for $s {
|
||||
#[inline(always)]
|
||||
unsafe fn get_static_pool() -> *const () {
|
||||
static POOL: $($p)::+<$t$(, $l)?> = $($p)::+::new();
|
||||
(&POOL as *const $($p)::+<$t$(, $l)?>).cast()
|
||||
}
|
||||
}
|
||||
)*
|
||||
};
|
||||
}
|
||||
pub use __static_pool__ as static_pool;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue