pub struct Charset {
pub space: char,
pub down_and_left: char,
pub down_and_right: char,
pub up_and_left: char,
pub up_and_right: char,
pub horizontal: char,
pub vertical: char,
pub down_and_horizontal: char,
pub up_and_horizontal: char,
pub vertical_and_left: char,
pub vertical_and_right: char,
pub vertical_and_horizontal: char,
}Expand description
A set of characters to use in the diagram.
In most cases, you would use some combination of box-drawing characters.
The rounded_corners character set often looks the best if there is
font support, whereas the sharp_corners tends to have more universal
font support.
When used in the Style struct, an IOWriter or a FmtWriter expects that these are
characters with width exactly 1 when displayed to the terminal. Other characters,
such as control characters or double-width characters (mainly those described in
Unicode Annex #11) will corrupt the
branch diagram.
Fields§
§space: charThe character.
down_and_left: charThe ╮ character.
down_and_right: charThe ╭ character.
up_and_left: charThe ╯ character.
up_and_right: charThe ╰ character.
horizontal: charThe ─ character.
vertical: charThe │ character.
down_and_horizontal: charThe ┬ character.
up_and_horizontal: charThe ┴ character.
vertical_and_left: charThe ┤ character.
vertical_and_right: charThe ├ character.
vertical_and_horizontal: charThe ┼ character.
Implementations§
Source§impl Charset
impl Charset
Sourcepub const fn rounded_corners() -> Self
pub const fn rounded_corners() -> Self
The rounded corners character set.
╯ ┴ ╰
┤ ┼ ├ ─
╮ ┬ ╭ │Sourcepub const fn sharp_corners() -> Self
pub const fn sharp_corners() -> Self
The sharp corners character set.
┘ ┴ └
┤ ┼ ├ ─
┐ ┬ ┌ │Sourcepub const fn doubled_lines() -> Self
pub const fn doubled_lines() -> Self
The doubled lines character set.
╝ ╩ ╚
╣ ╬ ╠ ═
╗ ╦ ╔ ║Sourcepub const fn invert(self) -> Self
pub const fn invert(self) -> Self
Flip the orientation of the charset vertically.
This swaps the down_* characters with the up_* characters. This is useful when you
want to render the branch diagram with the root at the bottom since
it will make the branch diagram lines connect correctly when the lines are written in
reverse order.
Also see Config::inverted_annotations to modify the layout algorithm to
draw annotations correctly.