#[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: u64Size 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>
impl<T: Default + Copy + Clone + Pod + Zeroable, const MAX_SIZE: usize, const NUM_REGISTERS: usize> NodeAllocator<T, MAX_SIZE, NUM_REGISTERS>
pub fn new() -> Self
pub fn initialize(&mut self)
pub fn get(&self, i: u32) -> &Node<T, NUM_REGISTERS>
pub fn get_mut(&mut self, i: u32) -> &mut Node<T, NUM_REGISTERS>
Sourcepub fn add_node(&mut self, node: T) -> u32
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
Sourcepub fn remove_node(&mut self, i: u32) -> Option<&T>
pub fn remove_node(&mut self, i: u32) -> Option<&T>
Removes the node at index i from the allocator and adds the index to the free list
When deleting nodes, you MUST clear all registers prior to calling remove_node
pub fn disconnect(&mut self, i: u32, j: u32, r_i: u32, r_j: u32)
pub fn clear_register(&mut self, i: u32, r_i: u32)
pub fn connect(&mut self, i: u32, j: u32, r_i: u32, r_j: u32)
pub fn set_register(&mut self, i: u32, value: u32, r_i: u32)
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>
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>
fn clone(&self) -> NodeAllocator<T, MAX_SIZE, NUM_REGISTERS>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Default + Copy + Clone + Pod + Zeroable, const MAX_SIZE: usize, const NUM_REGISTERS: usize> Default for NodeAllocator<T, MAX_SIZE, NUM_REGISTERS>
impl<T: Default + Copy + Clone + Pod + Zeroable, const MAX_SIZE: usize, const NUM_REGISTERS: usize> Default for NodeAllocator<T, MAX_SIZE, NUM_REGISTERS>
Source§impl<T: Default + Copy + Clone + Pod + Zeroable, const MAX_SIZE: usize, const NUM_REGISTERS: usize> ZeroCopy for NodeAllocator<T, MAX_SIZE, NUM_REGISTERS>
impl<T: Default + Copy + Clone + Pod + Zeroable, const MAX_SIZE: usize, const NUM_REGISTERS: usize> ZeroCopy for NodeAllocator<T, MAX_SIZE, NUM_REGISTERS>
fn load_mut_bytes(data: &mut [u8]) -> Option<&mut Self>
fn load_bytes(data: &[u8]) -> Option<&Self>
Source§impl<T: Default + Copy + Clone + Pod + Zeroable, const MAX_SIZE: usize, const NUM_REGISTERS: usize> Zeroable for NodeAllocator<T, MAX_SIZE, NUM_REGISTERS>
impl<T: Default + Copy + Clone + Pod + Zeroable, const MAX_SIZE: usize, const NUM_REGISTERS: usize> Zeroable for NodeAllocator<T, MAX_SIZE, NUM_REGISTERS>
impl<T: Copy + Default + Copy + Clone + Pod + Zeroable, const MAX_SIZE: usize, const NUM_REGISTERS: usize> Copy for NodeAllocator<T, MAX_SIZE, NUM_REGISTERS>
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> Freeze for NodeAllocator<T, MAX_SIZE, NUM_REGISTERS>where
T: Freeze,
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> 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
Mutably borrows from an owned value. Read more
Source§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
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
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret
bits
as &Self.