Trait workflow_terminal::terminal::PadStr
source · pub trait PadStr {
// Required method
fn pad(
&self,
width: usize,
pad_char: char,
alignment: Alignment,
truncate: bool,
) -> String;
// Provided methods
fn pad_to_width(&self, width: usize) -> String { ... }
fn pad_to_width_with_char(&self, width: usize, pad_char: char) -> String { ... }
fn pad_to_width_with_alignment(
&self,
width: usize,
alignment: Alignment,
) -> String { ... }
fn with_exact_width(&self, width: usize) -> String { ... }
}
Expand description
Functions to do with string padding.
Required Methods§
Provided Methods§
sourcefn pad_to_width(&self, width: usize) -> String
fn pad_to_width(&self, width: usize) -> String
Pad a string to be at least the given width by adding spaces on the right.
sourcefn pad_to_width_with_char(&self, width: usize, pad_char: char) -> String
fn pad_to_width_with_char(&self, width: usize, pad_char: char) -> String
Pad a string to be at least the given width by adding the given character on the right.
sourcefn pad_to_width_with_alignment(
&self,
width: usize,
alignment: Alignment,
) -> String
fn pad_to_width_with_alignment( &self, width: usize, alignment: Alignment, ) -> String
Pad a string to be at least the given with by adding spaces around it.
sourcefn with_exact_width(&self, width: usize) -> String
fn with_exact_width(&self, width: usize) -> String
Pad a string to be exactly the given width by either adding spaces on the right, or by truncating it to that width.