#[repr(C)]
pub struct NodeAllocator<T: Default + Copy + Clone + Pod + Zeroable, const MAX_SIZE: usize, const NUM_REGISTERS: usize> { pub size: u64, pub nodes: [Node<T, NUM_REGISTERS>; MAX_SIZE], /* private fields */ }

Fields§

§size: u64

Size of the allocator. The max value this can take is MAX_SIZE

§nodes: [Node<T, NUM_REGISTERS>; MAX_SIZE]

Nodes containing data, with NUM_REGISTERS registers that store arbitrary data

Implementations§

source§

impl<T: Default + Copy + Clone + Pod + Zeroable, const MAX_SIZE: usize, const NUM_REGISTERS: usize> NodeAllocator<T, MAX_SIZE, NUM_REGISTERS>

source

pub fn new() -> Self

source

pub fn initialize(&mut self)

source

pub fn get(&self, i: u32) -> &Node<T, NUM_REGISTERS>

source

pub fn get_mut(&mut self, i: u32) -> &mut Node<T, NUM_REGISTERS>

source

pub fn add_node(&mut self, node: T) -> u32

Adds a new node to the allocator. The function returns the current pointer to the free list, where the new node is inserted

source

pub fn remove_node(&mut self, i: u32) -> Option<&T>

Removes the node at index i from the alloctor and adds the index to the free list When deleting nodes, you MUST clear all registers prior to calling remove_node

source

pub fn disconnect(&mut self, i: u32, j: u32, r_i: u32, r_j: u32)

source

pub fn clear_register(&mut self, i: u32, r_i: u32)

source

pub fn connect(&mut self, i: u32, j: u32, r_i: u32, r_j: u32)

source

pub fn set_register(&mut self, i: u32, value: u32, r_i: u32)

source

pub fn get_register(&self, i: u32, r_i: u32) -> u32

Trait Implementations§

source§

impl<T: Clone + Default + Copy + Clone + Pod + Zeroable, const MAX_SIZE: usize, const NUM_REGISTERS: usize> Clone for NodeAllocator<T, MAX_SIZE, NUM_REGISTERS>

source§

fn clone(&self) -> NodeAllocator<T, MAX_SIZE, NUM_REGISTERS>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<T: Default + Copy + Clone + Pod + Zeroable, const MAX_SIZE: usize, const NUM_REGISTERS: usize> Default for NodeAllocator<T, MAX_SIZE, NUM_REGISTERS>

source§

fn default() -> Self

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

impl<T: Default + Copy + Clone + Pod + Zeroable, const MAX_SIZE: usize, const NUM_REGISTERS: usize> ZeroCopy for NodeAllocator<T, MAX_SIZE, NUM_REGISTERS>

source§

impl<T: Default + Copy + Clone + Pod + Zeroable, const MAX_SIZE: usize, const NUM_REGISTERS: usize> Zeroable for NodeAllocator<T, MAX_SIZE, NUM_REGISTERS>

source§

fn zeroed() -> Self

source§

impl<T: Copy + Default + Copy + Clone + Pod + Zeroable, const MAX_SIZE: usize, const NUM_REGISTERS: usize> Copy for NodeAllocator<T, MAX_SIZE, NUM_REGISTERS>

source§

impl<T: Default + Copy + Clone + Pod + Zeroable, const MAX_SIZE: usize, const NUM_REGISTERS: usize> Pod for NodeAllocator<T, MAX_SIZE, NUM_REGISTERS>

Auto Trait Implementations§

§

impl<T, const MAX_SIZE: usize, const NUM_REGISTERS: usize> RefUnwindSafe for NodeAllocator<T, MAX_SIZE, NUM_REGISTERS>where T: RefUnwindSafe,

§

impl<T, const MAX_SIZE: usize, const NUM_REGISTERS: usize> Send for NodeAllocator<T, MAX_SIZE, NUM_REGISTERS>where T: Send,

§

impl<T, const MAX_SIZE: usize, const NUM_REGISTERS: usize> Sync for NodeAllocator<T, MAX_SIZE, NUM_REGISTERS>where T: Sync,

§

impl<T, const MAX_SIZE: usize, const NUM_REGISTERS: usize> Unpin for NodeAllocator<T, MAX_SIZE, NUM_REGISTERS>where T: Unpin,

§

impl<T, const MAX_SIZE: usize, const NUM_REGISTERS: usize> UnwindSafe for NodeAllocator<T, MAX_SIZE, NUM_REGISTERS>where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> CheckedBitPattern for Twhere T: AnyBitPattern,

§

type Bits = T

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
source§

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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> ToOwned for Twhere T: Clone,

§

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, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<T> AnyBitPattern for Twhere T: Pod,

source§

impl<T> NoUninit for Twhere T: Pod,