Struct FlangedTree

Source
pub struct FlangedTree<TD, A>
where TD: TreeData,
{ /* private fields */ }

Implementations§

Source§

impl<TD, A> FlangedTree<TD, A>
where TD: TreeData,

Source

pub fn new(base: TD, data: Vec<A>) -> Self

Source

pub fn replace_map_flange<'a, B, F>(&'a self, mapf: F) -> FlangedTree<TD, B>
where F: Fn(<FlangedTree<TD, A> as Tree<'a>>::Node) -> B,

Source

pub fn get_flange(&self, index: usize) -> &A

Source

pub fn get_flange_mut(&mut self, index: usize) -> &mut A

Trait Implementations§

Source§

impl<'a, TD, A> Tree<'a> for FlangedTree<TD, A>
where A: 'a, TD: TreeData + 'a,

Source§

type Node = (<TD as TreeData>::Node, &'a A)

The type of the trees nodes
Source§

type SubtreeType = SubtreeImpl<&'a FlangedTree<TD, A>>

The type of the subtree, returned by root()
Source§

fn at_pos(&'a self, index: usize) -> Self::SubtreeType

Direct access to a node in the tree via its position in the flat map
Source§

fn get_nav(&self) -> &Navigator

Direct access to the Navigator storing the neighboring information of the tree
Source§

fn root(&'a self) -> Self::SubtreeType

The root node of the tree.
Source§

fn node_count(&'a self) -> usize

The number of nodes in the tree.
Source§

fn map<B, M>(&'a self, m: M) -> MappedTree<Self::Node, B, M, &'a Self>
where M: Fn(usize, Self::Node) -> B,

Create a new tree using a function to map from the nodes of this tree. The map function can also include external data sources. Read more
Source§

fn flange<B>(&'a self, data: Vec<B>) -> FlangedTree<&'a Self, B>

Flange data to the nodes. A new tree is created, that references the old tree and whos Node type is a typle with a reference to the old data and a reference to the new data from the inserted data vector.
Source§

fn flange_map<B, F>(&'a self, mapf: F) -> FlangedTree<&'a Self, B>
where B: 'a + Clone, F: Fn(Self::Node) -> B,

Use flange, but create the data using the mapf function
Source§

fn for_each<F>(&'a self, f: F)
where F: FnMut(Self::SubtreeType),

Source§

fn depth_first_flange<B, F>(&'a self, mapf: F) -> FlangedTree<&'a Self, B>
where B: 'a + Default + Clone, F: Fn(Self::Node, Vec<&B>) -> B,

Flange data to the nodes using a map function in a depth first order. Read more

Auto Trait Implementations§

§

impl<TD, A> Freeze for FlangedTree<TD, A>
where TD: Freeze,

§

impl<TD, A> RefUnwindSafe for FlangedTree<TD, A>

§

impl<TD, A> Send for FlangedTree<TD, A>
where TD: Send, A: Send,

§

impl<TD, A> Sync for FlangedTree<TD, A>
where TD: Sync, A: Sync,

§

impl<TD, A> Unpin for FlangedTree<TD, A>
where TD: Unpin, A: Unpin,

§

impl<TD, A> UnwindSafe for FlangedTree<TD, A>
where TD: UnwindSafe, A: 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 = Infallible

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

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

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.