TerminalManager

Trait TerminalManager 

Source
pub unsafe trait TerminalManager<'id, InnerNode, EdgeTag, ManagerData, const PAGE_SIZE: usize, const TAG_BITS: u32>: Sized {
    type TerminalNode: Eq + Hash;
    type TerminalNodeRef<'a>: Borrow<Self::TerminalNode> + Copy
       where Self: 'a;
    type Iterator<'a>: Iterator<Item = Edge<'id, InnerNode, EdgeTag, TAG_BITS>>
       where Self: 'a;

    // Required methods
    unsafe fn new_in(slot: *mut Self);
    fn terminal_manager(
        edge: &Edge<'id, InnerNode, EdgeTag, TAG_BITS>,
    ) -> NonNull<Self>;
    fn len(&self) -> usize;
    fn deref_edge(
        &self,
        edge: &Edge<'id, InnerNode, EdgeTag, TAG_BITS>,
    ) -> Self::TerminalNodeRef<'_>;
    fn clone_edge(
        edge: &Edge<'id, InnerNode, EdgeTag, TAG_BITS>,
    ) -> Edge<'id, InnerNode, EdgeTag, TAG_BITS>;
    fn drop_edge(edge: Edge<'id, InnerNode, EdgeTag, TAG_BITS>);
    unsafe fn get(
        this: *const Self,
        terminal: Self::TerminalNode,
    ) -> AllocResult<Edge<'id, InnerNode, EdgeTag, TAG_BITS>>;
    unsafe fn iter<'a>(this: *const Self) -> Self::Iterator<'a>
       where Self: 'a;
    fn gc(&self) -> usize;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

Manager for terminal nodes

§Safety

TerminalManager::new_in() must properly initialize the given slot and return a reference to the initialized slot.

Required Associated Types§

Source

type TerminalNode: Eq + Hash

Source

type TerminalNodeRef<'a>: Borrow<Self::TerminalNode> + Copy where Self: 'a

Source

type Iterator<'a>: Iterator<Item = Edge<'id, InnerNode, EdgeTag, TAG_BITS>> where Self: 'a

Required Methods§

Source

unsafe fn new_in(slot: *mut Self)

Create a new TerminalManager in the given slot

§Safety

slot is valid for writes and properly aligned. When returning from this function, the location referenced by slot is initialized. With respect to Stacked / Tree borrows, slot is tagged as the root of the allocation.

Source

fn terminal_manager( edge: &Edge<'id, InnerNode, EdgeTag, TAG_BITS>, ) -> NonNull<Self>

Get a pointer to the terminal store

Source

fn len(&self) -> usize

Get the number of currently stored terminals

Source

fn deref_edge( &self, edge: &Edge<'id, InnerNode, EdgeTag, TAG_BITS>, ) -> Self::TerminalNodeRef<'_>

Dereference the given edge

Source

fn clone_edge( edge: &Edge<'id, InnerNode, EdgeTag, TAG_BITS>, ) -> Edge<'id, InnerNode, EdgeTag, TAG_BITS>

Clone the given edge

Source

fn drop_edge(edge: Edge<'id, InnerNode, EdgeTag, TAG_BITS>)

Drop the given edge

Source

unsafe fn get( this: *const Self, terminal: Self::TerminalNode, ) -> AllocResult<Edge<'id, InnerNode, EdgeTag, TAG_BITS>>

Add a terminal to this manager (if it does not already exist) and return an Edge pointing to it

§Safety

this is valid for reads, properly aligned and initialized. With respect to Stacked / Tree Borrows, this is tagged as the root of the allocation.

Source

unsafe fn iter<'a>(this: *const Self) -> Self::Iterator<'a>
where Self: 'a,

Iterate over all terminals

§Safety

this is valid for reads, properly aligned and initialized during 'a. With respect to Stacked / Tree Borrows, this is tagged as the root of the allocation.

Source

fn gc(&self) -> usize

Garbage collection: remove unused terminals

Provided Methods§

Source

fn is_empty(&self) -> bool

Returns true iff currently no terminals are stored

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.

Implementors§

Source§

impl<'id, Terminal, InnerNode, EdgeTag, ManagerData, const PAGE_SIZE: usize, const TAG_BITS: u32> TerminalManager<'id, InnerNode, EdgeTag, ManagerData, PAGE_SIZE, TAG_BITS> for StaticTerminalManager<'id, Terminal, InnerNode, EdgeTag, ManagerData, PAGE_SIZE, TAG_BITS>
where Terminal: Countable + Eq + Hash, InnerNode: NodeBase, EdgeTag: Tag,

Source§

type TerminalNode = Terminal

Source§

type TerminalNodeRef<'a> = Terminal where Self: 'a

Source§

type Iterator<'a> = StaticTerminalIterator<'id, InnerNode, EdgeTag, TAG_BITS> where Self: 'a, 'id: 'a