pub struct NodeId(/* private fields */);Expand description
Generational node identity: index: 24 | generation: 8. Raw 0 is NodeId::NULL.
Indices are recycled only at frame boundaries; the 8-bit generation catches stale IDs across frames without hash maps or heap allocations.
Implementations§
Source§impl NodeId
impl NodeId
pub const NULL: NodeId
pub const INDEX_BITS: u32 = 24
pub const MAX_INDEX: u32
Sourcepub const fn new(index: u32, generation: u8) -> NodeId
pub const fn new(index: u32, generation: u8) -> NodeId
Constructs a handle from a 24-bit slot index and 8-bit generation.
Debug-asserts index <= MAX_INDEX. Both index 0 and out-of-range indices
(> MAX_INDEX) canonicalize to Self::NULL in release builds (never wrapping
to a live slot such as Self::ROOT); for explicit validation use
Self::try_new or Self::from_raw.
Sourcepub const fn try_new(index: u32, generation: u8) -> Option<NodeId>
pub const fn try_new(index: u32, generation: u8) -> Option<NodeId>
Fallible constructor rejecting null index 0 and any index > MAX_INDEX.
Sourcepub const fn from_raw(raw: u32) -> Option<NodeId>
pub const fn from_raw(raw: u32) -> Option<NodeId>
Decodes a raw u32 at FFI/wire ingress, rejecting any handle whose 24-bit index is 0
(both 0 and non-zero generations paired with index 0).
Sourcepub const fn from_raw_or_null(raw: u32) -> NodeId
pub const fn from_raw_or_null(raw: u32) -> NodeId
Decodes a nullable raw u32 at FFI/wire ingress, canonicalizing any index-0 value
to Self::NULL.
pub const fn index(self) -> usize
pub const fn index_u32(self) -> u32
pub const fn generation(self) -> u8
pub const fn raw(self) -> u32
Trait Implementations§
impl Copy for NodeId
Source§impl<'de> Deserialize<'de> for NodeId
Available on crate feature serde only.
impl<'de> Deserialize<'de> for NodeId
serde only.Source§fn deserialize<D>(
deserializer: D,
) -> Result<NodeId, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<NodeId, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
impl Eq for NodeId
Source§impl NvAliasSchema for NodeId
impl NvAliasSchema for NodeId
const SCHEMA: AbiAliasDescriptor
Source§impl NvDecode for NodeId
impl NvDecode for NodeId
Source§const MIN_ENCODED_BYTES: usize = 4
const MIN_ENCODED_BYTES: usize = 4
fn decode(r: &mut ByteReader<'_>) -> Result<NodeId, CodecError>
fn decode_exact(bytes: &[u8]) -> Result<Self, CodecError>
Source§impl OptWord for NodeId
impl OptWord for NodeId
const OPT_BITS: u8 = 32
const OPT_KIND: FieldKind = FieldKind::Node
const OPT_ENCODING: OptEncoding = OptEncoding::ZeroNiche
fn opt_to_bits(v: Option<Self>) -> u32
fn opt_from_bits(bits: u32) -> Option<Self>
Source§const VALUES: Option<&'static ValueSetDesc> = None
const VALUES: Option<&'static ValueSetDesc> = None
WordValue::VALUES).Source§impl Ord for NodeId
impl Ord for NodeId
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for NodeId
impl PartialOrd for NodeId
Source§impl Serialize for NodeId
Available on crate feature serde only.
impl Serialize for NodeId
serde only.Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
impl StructuralPartialEq for NodeId
Source§impl WordValue for NodeId
impl WordValue for NodeId
const BITS: u8 = 32
const KIND: FieldKind = FieldKind::Node
fn to_bits(self) -> u32
fn from_bits(bits: u32) -> Self
Source§const OPT_ENCODING: OptEncoding = OptEncoding::Required
const OPT_ENCODING: OptEncoding = OptEncoding::Required
TableDesc::schema_hash.Source§const VALUES: Option<&'static ValueSetDesc> = None
const VALUES: Option<&'static ValueSetDesc> = None
WordEnum variants, word_flags! bits), mirrored to hosts as
NV_<TYPE>_<VALUE> by codegen so foreign code never hand-copies them.Source§fn to_masked_bits(self, _bit_width: u32) -> u32
fn to_masked_bits(self, _bit_width: u32) -> u32
Source§fn from_masked_bits(bits: u32, _bit_width: u32) -> Self
fn from_masked_bits(bits: u32, _bit_width: u32) -> Self
bits from a field of bit_width (1..=32) bits (sign-extending narrowed signed
integers).Auto Trait Implementations§
impl Forget for NodeId
impl Freeze for NodeId
impl Move for NodeId
impl RefUnwindSafe for NodeId
impl Send for NodeId
impl Sync for NodeId
impl Unpin for NodeId
impl UnsafeUnpin for NodeId
impl UnwindSafe for NodeId
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> ScalarField for Twhere
T: WordValue,
impl<T> ScalarField for Twhere
T: WordValue,
fn read_row( row: &[u32], word: usize, shift: u32, mask: u32, _val_word: usize, ) -> T
fn write_row( self, writer: &mut RowWriter<'_>, word: usize, shift: u32, mask: u32, _val_word: usize, )
Source§fn encode_patch_ops(
self,
word: usize,
shift: u32,
mask: u32,
_val_word: usize,
emit: &mut dyn FnMut(usize, u32, u32),
)
fn encode_patch_ops( self, word: usize, shift: u32, mask: u32, _val_word: usize, emit: &mut dyn FnMut(usize, u32, u32), )
(word_idx, clear_mask, set_bits) masked patch operations for crate::RowPatch.fn read_ref( row: RowRef<'_>, word: usize, shift: u32, mask: u32, val_word: usize, ) -> Self
Source§impl<T> TableField for Twhere
T: WordValue,
impl<T> TableField for Twhere
T: WordValue,
const KIND: FieldKind = const KIND: FieldKind = T::KIND;
Source§const OPT_ENCODING: OptEncoding = const OPT_ENCODING: OptEncoding = T::OPT_ENCODING;
const OPT_ENCODING: OptEncoding = const OPT_ENCODING: OptEncoding = T::OPT_ENCODING;
TableDesc::schema_hash.Source§const BITS: u8 = const BITS: u8 = T::BITS;
const BITS: u8 = const BITS: u8 = T::BITS;
1..=32 for scalar, 1 for wide Option<T>, 64 for 64-bit/Str).Source§const PACK_KIND: PackKind = const PACK_KIND: PackKind = PackKind::Scalar;
const PACK_KIND: PackKind = const PACK_KIND: PackKind = PackKind::Scalar;
Scalar, WideOpt, Wide64, Str, Resource).Source§const VALUES: Option<&'static ValueSetDesc> = const VALUES: Option<&'static ValueSetDesc> = T::VALUES;
const VALUES: Option<&'static ValueSetDesc> = const VALUES: Option<&'static ValueSetDesc> = T::VALUES;
WordValue::VALUES).