pub trait NodeData<T> {
    // Required methods
    fn active(value: T) -> Self;
    fn get(&self) -> Option<&T>;
    fn get_mut(&mut self) -> Option<&mut T>;
    fn swap_data(&mut self, new_value: T) -> T;
}
Expand description

Trait representing how the node data will be stored in a self referential collection.

Required Methods§

source

fn active(value: T) -> Self

Creates a new active node data with the given value.

source

fn get(&self) -> Option<&T>

Returns a reference to the stored value; returns None if the node is not active.

source

fn get_mut(&mut self) -> Option<&mut T>

Returns a mutable reference to the stored value; returns None if the node is not active.

source

fn swap_data(&mut self, new_value: T) -> T

Updates the node data with the new_value and returns back the old value.

Object Safety§

This trait is not object safe.

Implementors§