Trait NodeIndex

Source
pub trait NodeIndex:
    Clone
    + Copy
    + Default {
    type NonMax: NodeIndexNonMax + TryFrom<Self> + Into<Self>;

    const MAX: u32;

    // Required methods
    fn from_u32(val: u32) -> Self;
    fn to_usize(self) -> usize;
}
Expand description

Determines the number of allocations that the allocator supports.

By default, Allocator and related functions use u32, which allows for u32::MAX - 1 allocations. You can, however, use u16 instead, which causes the allocator to use less memory but limits the number of allocations within a single allocator to at most 65,534.

Required Associated Constants§

Source

const MAX: u32

The maximum value representable in this type.

Required Associated Types§

Source

type NonMax: NodeIndexNonMax + TryFrom<Self> + Into<Self>

The NonMax version of this type.

This is used extensively to optimize enum representations.

Required Methods§

Source

fn from_u32(val: u32) -> Self

Converts from a unsigned 32-bit integer to an instance of this type.

Source

fn to_usize(self) -> usize

Converts this type to an unsigned machine word.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl NodeIndex for u16

Source§

const MAX: u32 = 65_535u32

Source§

type NonMax = NonMaxU16

Source§

fn from_u32(val: u32) -> Self

Source§

fn to_usize(self) -> usize

Source§

impl NodeIndex for u32

Source§

const MAX: u32 = 4_294_967_295u32

Source§

type NonMax = NonMaxU32

Source§

fn from_u32(val: u32) -> Self

Source§

fn to_usize(self) -> usize

Implementors§