Struct Style

Source
pub struct Style {
    pub char_set: CharSet,
    pub indentation: u32,
    pub leaf_style: TextStyle,
    pub branch_style: TextStyle,
}
Expand description

A type that describes the way a type that implements DisplayTree should be formatted.

Prefer using builder methods, either on Style or AsTree, over constructing an instance of Style manually.

Note: StyleBuilder must be in scope to use builder methods.

§Examples

use display_tree::{CharSet, Color, Style, StyleBuilder};

let style = Style::default()
    .leaf_color(Color::Blue)
    .branch_background_color(Color::Red)
    .indentation(4)
    .char_set(CharSet::SINGLE_LINE_CURVED);

Fields§

§char_set: CharSet

The CharSet making up the branches of the tree.

§indentation: u32

The indentation of each node.

§leaf_style: TextStyle

The style of the leaves of the tree. See TextStyle for more information.

§branch_style: TextStyle

The style of the branches of the tree. See TextStyle for more information.

Trait Implementations§

Source§

impl Clone for Style

Source§

fn clone(&self) -> Style

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for Style

Source§

fn default() -> Self

Source§

impl StyleBuilder for Style

Source§

fn char_set(self, char_set: CharSet) -> Self

Sets the CharSet making up the branches of the tree. Read more
Source§

fn indentation(self, indentation: u32) -> Self

Sets the indentation of each node. Read more
Source§

fn leaf_style(self, style: TextStyle) -> Self

Sets the style of the leaves of the tree. See TextStyle for more information.
Source§

fn branch_style(self, style: TextStyle) -> Self

Sets the style of the branches of the tre. See TextStyle for more information.
Source§

fn leaf_color(self, color: Color) -> Self

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

fn leaf_background_color(self, color: Color) -> Self

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

fn bold_leaves(self) -> Self

Renders the leaves as bold.
Source§

fn faint_leaves(self) -> Self

Decreases the intensity of the leaves.
Source§

fn italic_leaves(self) -> Self

Italicises the leaves.
Source§

fn underlined_leaves(self) -> Self

Underlines the leaves.
Source§

fn strikethrough_leaves(self) -> Self

Causes the leaves to be crossed-out.
Source§

fn branch_color(self, color: Color) -> Self

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

fn branch_background_color(self, color: Color) -> Self

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

fn bold_branches(self) -> Self

Renders the branches as bold.
Source§

fn faint_branches(self) -> Self

Decreases the intensity of the branches.
Source§

impl Copy for Style

Auto Trait Implementations§

§

impl Freeze for Style

§

impl RefUnwindSafe for Style

§

impl Send for Style

§

impl Sync for Style

§

impl Unpin for Style

§

impl UnwindSafe for Style

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.