pub struct NumberFormat {
pub zero_padding: bool,
pub fill: char,
pub align: NumberAlign,
pub sign: Sign,
pub type_prefix: bool,
pub min_width: usize,
pub max_width: usize,
pub commas: bool,
pub precision: usize,
pub format_type: FormatType,
pub timezone: Timezone,
}Expand description
Represents a destructured specification of a provided format pattern string.
Fields§
§zero_padding: boolzero padding
fill: charfill character
align: NumberAlignalignment
sign: Signsign
type_prefix: booltype prefix
min_width: usizemin_width
max_width: usizemax_width
commas: boolcommas
precision: usizedecimals
format_type: FormatTypeformat type
timezone: Timezonetimezone
Implementations§
Source§impl NumberFormat
impl NumberFormat
Sourcepub fn new() -> NumberFormat
pub fn new() -> NumberFormat
create new number format
Sourcepub fn zero_padding(self) -> NumberFormat
pub fn zero_padding(self) -> NumberFormat
add zero padding
Sourcepub fn no_zero_padding(self) -> NumberFormat
pub fn no_zero_padding(self) -> NumberFormat
remove zero padding
Sourcepub fn fill(self, fill_char: char) -> NumberFormat
pub fn fill(self, fill_char: char) -> NumberFormat
set fill char
Sourcepub fn left_align(self) -> NumberFormat
pub fn left_align(self) -> NumberFormat
left align
Sourcepub fn right_align(self) -> NumberFormat
pub fn right_align(self) -> NumberFormat
right align
Sourcepub fn center_align(self) -> NumberFormat
pub fn center_align(self) -> NumberFormat
center align
Sourcepub fn left_sign_right_align(self) -> NumberFormat
pub fn left_sign_right_align(self) -> NumberFormat
signed right align
Sourcepub fn unsigned(self) -> NumberFormat
pub fn unsigned(self) -> NumberFormat
always add sign
Sourcepub fn signed(self) -> NumberFormat
pub fn signed(self) -> NumberFormat
always add sign
Sourcepub fn unsigned_space(self) -> NumberFormat
pub fn unsigned_space(self) -> NumberFormat
unsigned but with space
Sourcepub fn type_prefix(self) -> NumberFormat
pub fn type_prefix(self) -> NumberFormat
add type prefix
Sourcepub fn no_type_prefix(self) -> NumberFormat
pub fn no_type_prefix(self) -> NumberFormat
no type prefix
Sourcepub fn width(self, width: usize) -> NumberFormat
pub fn width(self, width: usize) -> NumberFormat
set width
Sourcepub fn min_width(self, min_width: usize) -> NumberFormat
pub fn min_width(self, min_width: usize) -> NumberFormat
set min_width
Sourcepub fn max_width(self, max_width: usize) -> NumberFormat
pub fn max_width(self, max_width: usize) -> NumberFormat
set max_width
Sourcepub fn width_option(self, width: Option<usize>) -> NumberFormat
pub fn width_option(self, width: Option<usize>) -> NumberFormat
set width
Sourcepub fn min_width_option(self, width: Option<usize>) -> NumberFormat
pub fn min_width_option(self, width: Option<usize>) -> NumberFormat
set min_width
Sourcepub fn max_width_option(self, width: Option<usize>) -> NumberFormat
pub fn max_width_option(self, width: Option<usize>) -> NumberFormat
set max_width
Sourcepub fn commas(self) -> NumberFormat
pub fn commas(self) -> NumberFormat
show commas
Sourcepub fn no_commas(self) -> NumberFormat
pub fn no_commas(self) -> NumberFormat
do not show commas
Sourcepub fn precision(self, precision: usize) -> NumberFormat
pub fn precision(self, precision: usize) -> NumberFormat
set precision
Sourcepub fn timezone_local(self) -> NumberFormat
pub fn timezone_local(self) -> NumberFormat
use local timezone
Sourcepub fn timezone_utc(self) -> NumberFormat
pub fn timezone_utc(self) -> NumberFormat
use utc timezone
Sourcepub fn scientific_notation(self) -> NumberFormat
pub fn scientific_notation(self) -> NumberFormat
format as scientific notation
Sourcepub fn si(self) -> NumberFormat
pub fn si(self) -> NumberFormat
format as SI (order of magnitude)
Sourcepub fn percentage(self) -> NumberFormat
pub fn percentage(self) -> NumberFormat
format as pecentage
Sourcepub fn binary(self) -> NumberFormat
pub fn binary(self) -> NumberFormat
format as binary
Sourcepub fn octal(self) -> NumberFormat
pub fn octal(self) -> NumberFormat
format as octal
Sourcepub fn hex(self) -> NumberFormat
pub fn hex(self) -> NumberFormat
format as hex
Sourcepub fn integer_oom(self) -> NumberFormat
pub fn integer_oom(self) -> NumberFormat
format as integer order of magnitude
Sourcepub fn float_oom(self) -> NumberFormat
pub fn float_oom(self) -> NumberFormat
format as float order of magnitude
Sourcepub fn timestamp(self) -> NumberFormat
pub fn timestamp(self) -> NumberFormat
format as float order of magnitude
Sourcepub fn format_type(self, format_type: &FormatType) -> NumberFormat
pub fn format_type(self, format_type: &FormatType) -> NumberFormat
set format type
Source§impl NumberFormat
impl NumberFormat
Trait Implementations§
Source§impl Clone for NumberFormat
impl Clone for NumberFormat
Source§fn clone(&self) -> NumberFormat
fn clone(&self) -> NumberFormat
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for NumberFormat
impl Debug for NumberFormat
Source§impl Default for NumberFormat
impl Default for NumberFormat
Source§fn default() -> NumberFormat
fn default() -> NumberFormat
Source§impl From<Captures<'_>> for NumberFormat
impl From<Captures<'_>> for NumberFormat
Source§impl From<NumberFormat> for CellFormatShorthand
impl From<NumberFormat> for CellFormatShorthand
Source§fn from(format: NumberFormat) -> CellFormatShorthand
fn from(format: NumberFormat) -> CellFormatShorthand
Source§impl From<UnknownFormat> for NumberFormat
impl From<UnknownFormat> for NumberFormat
Source§fn from(unknown_format: UnknownFormat) -> Self
fn from(unknown_format: UnknownFormat) -> Self
Source§impl TryFrom<&str> for NumberFormat
impl TryFrom<&str> for NumberFormat
Source§type Error = FormatError
type Error = FormatError
Source§fn try_from(pattern: &str) -> Result<NumberFormat, FormatError>
fn try_from(pattern: &str) -> Result<NumberFormat, FormatError>
Source§impl TryInto<NumberFormat> for CellFormat
impl TryInto<NumberFormat> for CellFormat
Source§type Error = FormatError
type Error = FormatError
Source§fn try_into(self) -> Result<NumberFormat, FormatError>
fn try_into(self) -> Result<NumberFormat, FormatError>
Auto Trait Implementations§
impl Freeze for NumberFormat
impl RefUnwindSafe for NumberFormat
impl Send for NumberFormat
impl Sync for NumberFormat
impl Unpin for NumberFormat
impl UnwindSafe for NumberFormat
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
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>
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>
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