pub struct Pad<S> {
pub align: Dir,
pub with: char,
pub count: usize,
pub kind: Kind,
pub style: S,
}Expand description
Pad any data with a given character until it reaches a certain width.
Fields§
§align: DirThe direction to place the text in when padding.
with: charThe character to pad with.
count: usizeThe width to target when padding.
kind: KindThe kind of padding.
style: SThe style being wrapped by this modifier.
Implementations§
Source§impl<S: Style> Pad<S>
impl<S: Style> Pad<S>
Sourcepub const fn left(with: char, count: usize, style: S) -> Self
pub const fn left(with: char, count: usize, style: S) -> Self
Pad left.
Shorthand for Pad { dir: Dir::Left, with, count, kind: Full, style }
Sourcepub const fn center(with: char, count: usize, style: S) -> Self
pub const fn center(with: char, count: usize, style: S) -> Self
Pad to the center.
Shorthand for Pad { dir: Dir::Center, with, count, kind: Full, style }
Sourcepub const fn right(with: char, count: usize, style: S) -> Self
pub const fn right(with: char, count: usize, style: S) -> Self
Pad right.
Shorthand for Pad { dir: Dir::Right, with, count, kind: Full, style }
Sourcepub const fn left_mod(with: char, count: usize, style: S) -> Self
pub const fn left_mod(with: char, count: usize, style: S) -> Self
Pad left using modulo padding.
Shorthand for Pad { dir: Dir::Left, with, count, kind: Mod, style }
Sourcepub const fn center_mod(with: char, count: usize, style: S) -> Self
pub const fn center_mod(with: char, count: usize, style: S) -> Self
Pad to the center using modulo padding.
Shorthand for Pad { dir: Dir::Center, with, count, kind: Mod, style }
Sourcepub const fn right_mod(with: char, count: usize, style: S) -> Self
pub const fn right_mod(with: char, count: usize, style: S) -> Self
Pad right using modulo padding.
Shorthand for Pad { dir: Dir::Right, with, count, kind: Mod, style }