Struct tree_decorator::decorator::Style[][src]

pub struct Style {
    pub block: bool,
    pub last: bool,
    pub dashed: bool,
    pub entry: Entry,
}
Expand description

A style to be applied to tree item.

Each field, called style item, can be opt-in by using it’s name at tree_item!.

Fields

block: bool

Start a new block level.

last: bool

Indicate last item on a block level.

Combining with Style::block will not decrease block level.

Last Item With New Block

By using Style::block with Style::last we can achieve a last item block while rendering previous absence of block correctly.

use tree_decorator::tree_item;

tree_item!(block, "Root Item");
tree_item!("Item A");
tree_item!(block; last, "Item B");
tree_item!("Item B-a");
tree_item!(last, "Item B-b");

Using crate::StandardDecorator, will result into:

Root Item
├  Item A
└  Item B
   ├  Item B-a
   └  Item B-b

Without Style::last from block; last style combination, will result into:

Root Item
├  Item A
├  Item B
│  ├  Item B-a
│  └  Item B-b
dashed: bool

Dashed block style.

entry: Entry

Entry style.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.