Trait TreeLike

Source
pub trait TreeLike: Sized {
    type Child<'a>: TreeChild<Self>
       where Self: 'a;
    type RefIter<'a>: Iterator<Item = Self::Child<'a>> + TreeChildIter<'a, Self>
       where Self: 'a;

    // Required method
    fn children(&self) -> Option<Self::RefIter<'_>>;

    // Provided methods
    fn dfs(&self) -> Option<DFSIter<'_, Self>> { ... }
    fn bfs(&self) -> Option<BFSIter<'_, Self>> { ... }
    fn bfs_par<'a>(&'a self) -> Option<ParSpliter<BFSIter<'a, Self>>>
       where Self::Child<'a>: Send,
             Self::RefIter<'a>: Send { ... }
    fn dfs_with_close<'a, R, SG, SL, Open: FnMut(&mut SG, Self::Child<'a>) -> Result<DFSContinuation<SL>, R>, Close: FnMut(&mut SG, SL) -> Result<(), R>>(
        &'a self,
        state: &mut SG,
        open: Open,
        close: Close,
    ) -> Result<(), R> { ... }
    fn display_nested<'a>(
        &'a self,
        f: &mut Formatter<'_>,
        open: impl Fn(&Self::Child<'a>, &mut Indentor<'_>, &mut Formatter<'_>) -> Result<DFSContinuation<()>, Error>,
        close: impl Fn(&Self::Child<'a>, &mut Formatter<'_>) -> Result,
        indent: Option<Indentor<'_>>,
    ) -> Result { ... }
    fn display_children<'a, I: Into<Self::RefIter<'a>>>(
        i: I,
        f: &mut Formatter<'_>,
        open: impl Fn(&Self::Child<'a>, &mut Indentor<'_>, &mut Formatter<'_>) -> Result<DFSContinuation<()>, Error>,
        close: impl Fn(&Self::Child<'a>, &mut Formatter<'_>) -> Result,
        indent: Option<Indentor<'_>>,
    ) -> Result
       where Self: 'a { ... }
}

Required Associated Types§

Source

type Child<'a>: TreeChild<Self> where Self: 'a

Source

type RefIter<'a>: Iterator<Item = Self::Child<'a>> + TreeChildIter<'a, Self> where Self: 'a

Required Methods§

Source

fn children(&self) -> Option<Self::RefIter<'_>>

Provided Methods§

Source

fn dfs(&self) -> Option<DFSIter<'_, Self>>

Source

fn bfs(&self) -> Option<BFSIter<'_, Self>>

Source

fn bfs_par<'a>(&'a self) -> Option<ParSpliter<BFSIter<'a, Self>>>
where Self::Child<'a>: Send, Self::RefIter<'a>: Send,

Available on crate feature rayon only.
Source

fn dfs_with_close<'a, R, SG, SL, Open: FnMut(&mut SG, Self::Child<'a>) -> Result<DFSContinuation<SL>, R>, Close: FnMut(&mut SG, SL) -> Result<(), R>>( &'a self, state: &mut SG, open: Open, close: Close, ) -> Result<(), R>

Source

fn display_nested<'a>( &'a self, f: &mut Formatter<'_>, open: impl Fn(&Self::Child<'a>, &mut Indentor<'_>, &mut Formatter<'_>) -> Result<DFSContinuation<()>, Error>, close: impl Fn(&Self::Child<'a>, &mut Formatter<'_>) -> Result, indent: Option<Indentor<'_>>, ) -> Result

Source

fn display_children<'a, I: Into<Self::RefIter<'a>>>( i: I, f: &mut Formatter<'_>, open: impl Fn(&Self::Child<'a>, &mut Indentor<'_>, &mut Formatter<'_>) -> Result<DFSContinuation<()>, Error>, close: impl Fn(&Self::Child<'a>, &mut Formatter<'_>) -> Result, indent: Option<Indentor<'_>>, ) -> Result
where Self: 'a,

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.

Implementations on Foreign Types§

Source§

impl TreeLike for DirEntry

Implementors§