Skip to main content

TreeBuilder

Struct TreeBuilder 

Source
pub struct TreeBuilder { /* private fields */ }
Expand description

A builder for creating tree-structured output.

Implementations§

Source§

impl TreeBuilder

Source

pub fn new() -> Self

Create a new tree builder.

Source

pub fn with_options(options: DumpOptions) -> Self

Create a new tree builder with options.

Source

pub fn options(&self) -> &DumpOptions

Get the dump options.

Source

pub fn show_keys(&self) -> bool

Check if show_keys is enabled.

Source

pub fn begin_node(&mut self, title: &str)

Add a node with a title (creates a branch point).

Source

pub fn add_leaf(&mut self, title: &str, props: &[(&str, String)])

Add a leaf node with properties.

Source

pub fn add_leaf_with_params( &mut self, title: &str, props: &[(&str, String)], params: Option<&ParameterCollection>, )

Add a leaf node with properties and optional params (for –show-keys debug).

When show_keys option is enabled, dumps all parameters from the collection. Otherwise behaves like add_leaf.

Source

pub fn push(&mut self, has_more_siblings: bool)

Push into a child group (for nesting).

Source

pub fn pop(&mut self)

Pop out of a child group.

Source

pub fn root(&mut self, title: &str)

Add a root node (no prefix).

Source

pub fn finish(self) -> String

Consume and return the built string.

Trait Implementations§

Source§

impl Default for TreeBuilder

Source§

fn default() -> TreeBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.
Source§

impl<G1, G2> Within<G2> for G1
where G2: Contains<G1>,

Source§

fn is_within(&self, b: &G2) -> bool