Skip to main content

NodeRef

Struct NodeRef 

Source
pub struct NodeRef<'a, K: Ord + Clone, V: Clone, const SIZE: usize>(/* private fields */);
Expand description

A borrowed node of a map’s tree, for a codec that must reproduce the tree’s sharing. Two views with the same identity are the same node; a NodeHandle from keep pins that identity for as long as it is held.

Implementations§

Source§

impl<'a, K: Ord + Clone, V: Clone, const SIZE: usize> NodeRef<'a, K, V, SIZE>

Source

pub fn identity(&self) -> usize

The node’s allocation address: equal for two views of one node, distinct for two nodes that are both alive.

Source

pub fn keep(&self) -> NodeHandle<K, V, SIZE>

An owned reference to this node.

Source

pub fn len(&self) -> usize

The number of pairs held in this node (not its subtrees).

Source

pub fn pairs(&self) -> impl Iterator<Item = (&'a K, &'a V)> + 'a

The node’s pairs in key order.

Source

pub fn left(&self) -> Option<NodeRef<'a, K, V, SIZE>>

Source

pub fn right(&self) -> Option<NodeRef<'a, K, V, SIZE>>

Auto Trait Implementations§

§

impl<'a, K, V, const SIZE: usize> Freeze for NodeRef<'a, K, V, SIZE>
where &'a Node<K, V, SIZE>: Freeze,

§

impl<'a, K, V, const SIZE: usize> RefUnwindSafe for NodeRef<'a, K, V, SIZE>
where &'a Node<K, V, SIZE>: RefUnwindSafe,

§

impl<'a, K, V, const SIZE: usize> Send for NodeRef<'a, K, V, SIZE>
where &'a Node<K, V, SIZE>: Send,

§

impl<'a, K, V, const SIZE: usize> Sync for NodeRef<'a, K, V, SIZE>
where &'a Node<K, V, SIZE>: Sync,

§

impl<'a, K, V, const SIZE: usize> Unpin for NodeRef<'a, K, V, SIZE>
where &'a Node<K, V, SIZE>: Unpin,

§

impl<'a, K, V, const SIZE: usize> UnsafeUnpin for NodeRef<'a, K, V, SIZE>
where &'a Node<K, V, SIZE>: UnsafeUnpin,

§

impl<'a, K, V, const SIZE: usize> UnwindSafe for NodeRef<'a, K, V, SIZE>
where &'a Node<K, V, SIZE>: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.