[−][src]Macro pui_core::scalar_allocator
Construct a new ScalarAllocator
For example:
pui_core::scalar_allocator! { /// Your scalar allocator struct Foo; } pui_core::scalar_allocator! { #[derive(Debug)] pub struct Bar(u8); } let foo = Foo; let bar = Bar;
Foo: ScalarAllocator
, and because it is guaratneed to
produce one scalar, it also implements Pool
with a Flag
. Bar: ScalarAllocator
, as you
can see it also has a paramter: u8
. You can use any type that
implements Scalar
in it's place. This type defines what sort
the inner type of Dynamic
and DynamicToken
.
For example you could use u64
:
pui_core::scalar_allocator! { #[derive(Debug)] pub struct Bar(u64); }
You can also prefix struct
with thread_local
to get a ScalarAllocator
that is only produces unique scalars on within a given thread
For example:
pui_core::scalar_allocator! { thread_local struct Foo; } pui_core::scalar_allocator! { thread_local struct Bar(u8); } let foo = Foo; let bar = Bar;