diff --git a/utils/src/arc_pool.rs b/utils/src/arc_pool.rs index b4fd8c88f..5fd782a1d 100644 --- a/utils/src/arc_pool.rs +++ b/utils/src/arc_pool.rs @@ -348,7 +348,7 @@ unsafe impl, 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, 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;