Skip to main content

NodeId

Struct NodeId 

Source
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

Source

pub const NULL: NodeId

Source

pub const ROOT: NodeId

Reserved root node of every surface (index 1, generation 0).

Source

pub const INDEX_BITS: u32 = 24

Source

pub const MAX_INDEX: u32

Source

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.

Source

pub const fn try_new(index: u32, generation: u8) -> Option<NodeId>

Fallible constructor rejecting null index 0 and any index > MAX_INDEX.

Source

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).

Source

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.

Source

pub const fn index(self) -> usize

Source

pub const fn index_u32(self) -> u32

Source

pub const fn generation(self) -> u8

Source

pub const fn is_null(self) -> bool

Returns true when the 24-bit slot index is 0.

Source

pub const fn raw(self) -> u32

Source§

impl NodeId

Source

pub const fn from_index(index: NodeIndex, generation: u8) -> NodeId

Source

pub const fn node_index(self) -> NodeIndex

Trait Implementations§

Source§

impl Clone for NodeId

Source§

fn clone(&self) -> NodeId

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for NodeId

Source§

impl Debug for NodeId

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for NodeId

Source§

fn default() -> NodeId

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for NodeId

Available on crate feature serde only.
Source§

fn deserialize<D>( deserializer: D, ) -> Result<NodeId, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for NodeId

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Eq for NodeId

Source§

impl Hash for NodeId

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl NvAliasSchema for NodeId

Source§

impl NvDecode for NodeId

Source§

const MIN_ENCODED_BYTES: usize = 4

Conservative minimum encoded byte size used to bound vector pre-allocation.
Source§

fn decode(r: &mut ByteReader<'_>) -> Result<NodeId, CodecError>

Source§

fn decode_exact(bytes: &[u8]) -> Result<Self, CodecError>

Source§

impl NvEncode for NodeId

Source§

impl NvSchema for NodeId

Source§

impl OptWord for NodeId

Source§

const OPT_BITS: u8 = 32

Source§

const OPT_KIND: FieldKind = FieldKind::Node

Source§

const OPT_ENCODING: OptEncoding = OptEncoding::ZeroNiche

Source§

fn opt_to_bits(v: Option<Self>) -> u32

Source§

fn opt_from_bits(bits: u32) -> Option<Self>

Source§

const VALUES: Option<&'static ValueSetDesc> = None

Named values of the inner type (see WordValue::VALUES).
Source§

impl Ord for NodeId

Source§

fn cmp(&self, other: &NodeId) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl PartialEq for NodeId

Source§

fn eq(&self, other: &NodeId) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialOrd for NodeId

Source§

fn partial_cmp(&self, other: &NodeId) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Serialize for NodeId

Available on crate feature serde only.
Source§

fn serialize<S>( &self, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for NodeId

Source§

impl WordValue for NodeId

Source§

const BITS: u8 = 32

Source§

const KIND: FieldKind = FieldKind::Node

Source§

fn to_bits(self) -> u32

Source§

fn from_bits(bits: u32) -> Self

Source§

const OPT_ENCODING: OptEncoding = OptEncoding::Required

Optionality & bit-encoding discriminator hashed into TableDesc::schema_hash.
Source§

const VALUES: Option<&'static ValueSetDesc> = None

Named values (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

Encodes self into a field of bit_width (1..=32) bits. Read more
Source§

fn from_masked_bits(bits: u32, _bit_width: u32) -> Self

Decodes 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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ScalarField for T
where T: WordValue,

Source§

fn read_row( row: &[u32], word: usize, shift: u32, mask: u32, _val_word: usize, ) -> T

Source§

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), )

Emits (word_idx, clear_mask, set_bits) masked patch operations for crate::RowPatch.
Source§

fn read_ref( row: RowRef<'_>, word: usize, shift: u32, mask: u32, val_word: usize, ) -> Self

Source§

impl<T> TableField for T
where T: WordValue,

Source§

const KIND: FieldKind = const KIND: FieldKind = T::KIND;

Source§

const OPT_ENCODING: OptEncoding = const OPT_ENCODING: OptEncoding = T::OPT_ENCODING;

Optionality & bit-encoding discriminator hashed into TableDesc::schema_hash.
Source§

const BITS: u8 = const BITS: u8 = T::BITS;

Bits occupied in its primary word (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;

Word packing layout shape (Scalar, WideOpt, Wide64, Str, Resource).
Source§

const VALUES: Option<&'static ValueSetDesc> = const VALUES: Option<&'static ValueSetDesc> = T::VALUES;

Named values the field holds (see WordValue::VALUES).
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.