macro_rules! handle {
(
[
offset: $prim:ident+$T:ty;
]
$(#[$handle_attr:meta])*
$vis:vis $Handle:ident $(;)?
) => { ... };
(
%handle
[offset:$prim:ident+$T:ty;]
$(#[$handle_attr:meta])* $vis:vis $Handle:ident) => { ... };
(
%main
[offset:$prim:ident+$T:ty;]
$(#[$handle_attr:meta])* $vis:vis $Handle:ident) => { ... };
}Expand description
๐๏ธ ๐ซ Defines a lightweight handle type.
๐ data/id
A handle is a lightweight, copyable semantic reference that identifies an entry within a managed collection, such as an arena, list, or graph.
Handles are plain data values. They contain only small scalar fields (like offsets, lengths, or indices) and no lifetimes or ownership.
Handles form the connective tissue of the data layer, bridging raw storage with higher-level structure.
ยงExamples
A simple handle for an arena.
handle! {
[offset: usize+NonMaxUsize; ]
/// A custom handle.
pub MyHandle;
}See also HandleSpanExample.