[][src]Struct nix_query_tree_viewer::tree::Tree

pub struct Tree<T> {
    pub item: T,
    pub children: Vec<Tree<T>>,
}

Fields

item: Tchildren: Vec<Tree<T>>

Methods

impl<T> Tree<T>[src]

pub fn new(item: T, children: Vec<Tree<T>>) -> Tree<T>[src]

pub fn singleton(item: T) -> Tree<T>[src]

pub fn lookup(&self, path: Path) -> Option<&T>[src]

Lookup the item in the Tree that corresponds to the given Path.

pub fn path_map_map<U>(&self, f: &dyn Fn(&T) -> U) -> TreePathMap<U> where
    U: Eq + Hash
[src]

Similar to path_map, but take a function for mapping an item in the tree to an alternative type to use to construct the TreePathMap.

This is useful when there is some information in the item for the Tree that can be thrown away when constructing the TreePathMap.

impl<T> Tree<T> where
    T: Clone + Eq + Hash
[src]

pub fn path_map(&self) -> TreePathMap<T>[src]

Create a TreePathMap for the elements in the Tree.

Trait Implementations

impl<T: Clone> Clone for Tree<T>[src]

impl<T: Debug> Debug for Tree<T>[src]

impl<T: Eq> Eq for Tree<T>[src]

impl<T: PartialEq> PartialEq<Tree<T>> for Tree<T>[src]

impl<T> StructuralEq for Tree<T>[src]

impl<T> StructuralPartialEq for Tree<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for Tree<T> where
    T: RefUnwindSafe

impl<T> Send for Tree<T> where
    T: Send

impl<T> Sync for Tree<T> where
    T: Sync

impl<T> Unpin for Tree<T> where
    T: Unpin

impl<T> UnwindSafe for Tree<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.