pub struct StringFormat {
pub min_width: usize,
pub max_width: usize,
pub align: StringAlign,
pub fill_char: char,
}Expand description
string format specification
Fields§
§min_width: usizemin_width of string, for padding
max_width: usizemax_width of string, for padding
align: StringAlignalign string to left or right
fill_char: charfill padding char
Implementations§
Source§impl StringFormat
impl StringFormat
Sourcepub fn new() -> StringFormat
pub fn new() -> StringFormat
create new number format
Sourcepub fn width(self, width: usize) -> StringFormat
pub fn width(self, width: usize) -> StringFormat
set width
Sourcepub fn min_width(self, min_width: usize) -> StringFormat
pub fn min_width(self, min_width: usize) -> StringFormat
set min_width
Sourcepub fn max_width(self, max_width: usize) -> StringFormat
pub fn max_width(self, max_width: usize) -> StringFormat
set max_width
Sourcepub fn width_option(self, width: Option<usize>) -> StringFormat
pub fn width_option(self, width: Option<usize>) -> StringFormat
set width
Sourcepub fn min_width_option(self, width: Option<usize>) -> StringFormat
pub fn min_width_option(self, width: Option<usize>) -> StringFormat
set min_width
Sourcepub fn max_width_option(self, width: Option<usize>) -> StringFormat
pub fn max_width_option(self, width: Option<usize>) -> StringFormat
set max_width
Sourcepub fn left_align(self) -> StringFormat
pub fn left_align(self) -> StringFormat
left align
Sourcepub fn right_align(self) -> StringFormat
pub fn right_align(self) -> StringFormat
right align
Sourcepub fn fill_char(self, fill_char: char) -> StringFormat
pub fn fill_char(self, fill_char: char) -> StringFormat
add fill char
Source§impl StringFormat
impl StringFormat
Trait Implementations§
Source§impl Clone for StringFormat
impl Clone for StringFormat
Source§fn clone(&self) -> StringFormat
fn clone(&self) -> StringFormat
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StringFormat
impl Debug for StringFormat
Source§impl Default for StringFormat
impl Default for StringFormat
Source§fn default() -> StringFormat
fn default() -> StringFormat
Returns the “default value” for a type. Read more
Source§impl From<StringFormat> for CellFormatShorthand
impl From<StringFormat> for CellFormatShorthand
Source§fn from(format: StringFormat) -> CellFormatShorthand
fn from(format: StringFormat) -> CellFormatShorthand
Converts to this type from the input type.
Source§impl From<UnknownFormat> for StringFormat
impl From<UnknownFormat> for StringFormat
Source§fn from(unknown_format: UnknownFormat) -> Self
fn from(unknown_format: UnknownFormat) -> Self
Converts to this type from the input type.
Source§impl TryInto<StringFormat> for CellFormat
impl TryInto<StringFormat> for CellFormat
Source§type Error = FormatError
type Error = FormatError
The type returned in the event of a conversion error.
Source§fn try_into(self) -> Result<StringFormat, FormatError>
fn try_into(self) -> Result<StringFormat, FormatError>
Performs the conversion.
Auto Trait Implementations§
impl Freeze for StringFormat
impl RefUnwindSafe for StringFormat
impl Send for StringFormat
impl Sync for StringFormat
impl Unpin for StringFormat
impl UnwindSafe for StringFormat
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more