[][src]Macro pui::make_global_id_alloc_tl

macro_rules! make_global_id_alloc_tl {
    ($(#[$meta:meta])* $v:vis type $name:ident($(#[$id_meta:meta])* $id:ident) = $inner:ty;) => { ... };
}
This is supported on crate feature std only.

Create a new type that implements IdAlloc that can be used with Runtime which is implemented using a thread-local count

For example,

pui::make_global_id_alloc_tl! {
    pub type MyIdAlloc(MyId) = [u8; 3];
}

will generate a 24-bit id_alloc that is 1 byte aligned. You can use any type that implements Scalar as the backing type of a id_alloc.

You can then use it like so,

let runtime_id_alloc /* : Runtime<MyIdAlloc> */ = MyIdAlloc::new();

or if you want to plug in a custom PoolMut<_>,

let runtime_id_alloc /* : Runtime<MyIdAlloc, _> */ = MyIdAlloc::with_pool(pool);