Trait offset_allocator::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 Types§

source

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

The NonMax version of this type.

This is used extensively to optimize enum representations.

Required Associated Constants§

source

const MAX: u32

The maximum value representable in this type.

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.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl NodeIndex for u16

§

type NonMax = NonMaxU16

source§

const MAX: u32 = 65_535u32

source§

fn from_u32(val: u32) -> Self

source§

fn to_usize(self) -> usize

source§

impl NodeIndex for u32

§

type NonMax = NonMaxU32

source§

const MAX: u32 = 4_294_967_295u32

source§

fn from_u32(val: u32) -> Self

source§

fn to_usize(self) -> usize

Implementors§