pub struct Tree<D: Display> {
pub root: D,
pub leaves: Vec<Tree<D>>,
/* private fields */
}
Expand description
a simple recursive type which is able to render its components in a tree-like format
Fields§
§root: D
§leaves: Vec<Tree<D>>
Implementations§
source§impl<D: Display> Tree<D>
impl<D: Display> Tree<D>
pub fn new(root: D) -> Self
pub fn with_leaves( self, leaves: impl IntoIterator<Item = impl Into<Tree<D>>>, ) -> Self
sourcepub fn with_multiline(self, yes: bool) -> Self
pub fn with_multiline(self, yes: bool) -> Self
Ensure all lines for root
are indented
sourcepub fn with_glyphs(self, glyphs: GlyphPalette) -> Self
pub fn with_glyphs(self, glyphs: GlyphPalette) -> Self
Customize the rendering of this node
source§impl<D: Display> Tree<D>
impl<D: Display> Tree<D>
sourcepub fn set_multiline(&mut self, yes: bool) -> &mut Self
pub fn set_multiline(&mut self, yes: bool) -> &mut Self
Ensure all lines for root
are indented
sourcepub fn set_glyphs(&mut self, glyphs: GlyphPalette) -> &mut Self
pub fn set_glyphs(&mut self, glyphs: GlyphPalette) -> &mut Self
Customize the rendering of this node
Trait Implementations§
source§impl<D: Display> Extend<D> for Tree<D>
impl<D: Display> Extend<D> for Tree<D>
source§fn extend<T: IntoIterator<Item = D>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = D>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
source§impl<D: Display> Extend<Tree<D>> for Tree<D>
impl<D: Display> Extend<Tree<D>> for Tree<D>
source§fn extend<T: IntoIterator<Item = Tree<D>>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = Tree<D>>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Auto Trait Implementations§
impl<D> Freeze for Tree<D>where
D: Freeze,
impl<D> RefUnwindSafe for Tree<D>where
D: RefUnwindSafe,
impl<D> Send for Tree<D>where
D: Send,
impl<D> Sync for Tree<D>where
D: Sync,
impl<D> Unpin for Tree<D>where
D: Unpin,
impl<D> UnwindSafe for Tree<D>where
D: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)