pub trait StyleBuilder: Sized {
Show 13 methods fn char_set(self, char_set: CharSet) -> Self { ... } fn indentation(self, indentation: u32) -> Self { ... } fn leaf_color(self, color: Color) -> Self { ... } fn leaf_background_color(self, color: Color) -> Self { ... } fn bold_leaves(self) -> Self { ... } fn faint_leaves(self) -> Self { ... } fn italic_leaves(self) -> Self { ... } fn underlined_leaves(self) -> Self { ... } fn strikethrough_leaves(self) -> Self { ... } fn branch_color(self, color: Color) -> Self { ... } fn branch_background_color(self, color: Color) -> Self { ... } fn bold_branches(self) -> Self { ... } fn faint_branches(self) -> Self { ... }
}
Expand description

A trait that provides builder methods for constructing an instance of Style.

StyleBuilder is implemented for Style and AsTree, so you can use those types to construct an instance of Style.

Do not implement StyleBuilder for any new types.

Provided Methods§

Sets the CharSet making up the branches of the tree.

See CharSet for more information.

Examples
use display_tree::{AsTree, CharSet, DisplayTree, StyleBuilder};

#[derive(DisplayTree)]
struct Tree {
    a: i32,
    b: i32,
}

let tree = Tree { a: 1, b: 2 };

assert_eq!(
    format!(
        "{}",
        // Use ASCII characters instead of the default Unicode ones.
        AsTree::new(&tree).char_set(CharSet::ASCII),
    ),
    "Tree\n\
     |-- 1\n\
     `-- 2",
);

Sets the indentation of each node.

More specifically, indentation() sets the number of horizontal characters to use for each branch of the tree.

Examples
use display_tree::{AsTree, DisplayTree, StyleBuilder};

#[derive(DisplayTree)]
struct Tree {
    a: i32,
    b: i32,
}

let tree = Tree { a: 1, b: 2 };

assert_eq!(
    format!("{}", AsTree::new(&tree).indentation(4),),
    "Tree\n\
     ├──── 1\n\
     └──── 2"
);

Sets the color of the leaves of the tree. See Color for more information.

Sets the background color of the leaves of the tree. See Color for more information.

Renders the leaves as bold.

Decreases the intensity of the leaves.

Italicises the leaves.

Underlines the leaves.

Causes the leaves to be crossed-out.

Sets the color of the branches of the tree. See Color for more information.

Sets the background color of the branches of the tree. See Color for more information.

Renders the branches as bold.

Decreases the intensity of the branches.

Implementors§