Skip to main content

define_index

Macro define_index 

Source
macro_rules! define_index {
    ($name:ident, $inner:ty, $doc:expr) => { ... };
}
Expand description

Creates a strongly-typed index wrapper around an integer type.

ยงExample

use feagi_structures::define_index;

define_index!(NodeId, u32, "Unique identifier for a node");

let id = NodeId::from(42);
assert_eq!(*id, 42);
let raw: u32 = id.into();
assert_eq!(raw, 42);