#[non_exhaustive]pub struct FormatSizeOptions {
pub base_unit: BaseUnit,
pub kilo: Kilo,
pub units: Kilo,
pub decimal_places: usize,
pub decimal_zeroes: usize,
pub fixed_at: Option<FixedAt>,
pub long_units: bool,
pub space_after_value: bool,
pub suffix: &'static str,
}
Expand description
Holds the options for the file_size
method.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.base_unit: BaseUnit
Whether the value being formatted represents an amount of bits or bytes.
kilo: Kilo
The scale (binary/decimal) to divide against.
units: Kilo
The unit set to display.
decimal_places: usize
The amount of decimal places to display if the decimal part is non-zero.
decimal_zeroes: usize
The amount of zeroes to display if the decimal part is zero.
fixed_at: Option<FixedAt>
Whether to force a certain representation and if so, which one.
long_units: bool
Whether to use the full unit (e.g. Kilobyte
) or its abbreviation (kB
).
space_after_value: bool
Whether to place a space between value and units.
suffix: &'static str
An optional suffix which will be appended after the unit. Useful to represent speeds (e.g. `1 kB/s)
Implementations§
Source§impl FormatSizeOptions
impl FormatSizeOptions
Sourcepub fn from(from: FormatSizeOptions) -> FormatSizeOptions
pub fn from(from: FormatSizeOptions) -> FormatSizeOptions
pub fn base_unit(self, base_unit: BaseUnit) -> FormatSizeOptions
pub fn kilo(self, kilo: Kilo) -> FormatSizeOptions
pub fn units(self, units: Kilo) -> FormatSizeOptions
Sourcepub fn decimal_places(self, decimal_places: usize) -> FormatSizeOptions
pub fn decimal_places(self, decimal_places: usize) -> FormatSizeOptions
pub fn decimal_zeroes(self, decimal_zeroes: usize) -> FormatSizeOptions
pub fn fixed_at(self, fixed_at: Option<FixedAt>) -> FormatSizeOptions
pub fn long_units(self, long_units: bool) -> FormatSizeOptions
pub fn space_after_value(self, insert_space: bool) -> FormatSizeOptions
pub fn suffix(self, suffix: &'static str) -> FormatSizeOptions
Trait Implementations§
Source§impl AsRef<FormatSizeOptions> for FormatSizeOptions
impl AsRef<FormatSizeOptions> for FormatSizeOptions
Source§fn as_ref(&self) -> &FormatSizeOptions
fn as_ref(&self) -> &FormatSizeOptions
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl Clone for FormatSizeOptions
impl Clone for FormatSizeOptions
Source§fn clone(&self) -> FormatSizeOptions
fn clone(&self) -> FormatSizeOptions
Returns a copy 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 FormatSizeOptions
impl Debug for FormatSizeOptions
Source§impl Default for FormatSizeOptions
impl Default for FormatSizeOptions
Source§fn default() -> FormatSizeOptions
fn default() -> FormatSizeOptions
Returns the “default value” for a type. Read more
impl Copy for FormatSizeOptions
Auto Trait Implementations§
impl Freeze for FormatSizeOptions
impl RefUnwindSafe for FormatSizeOptions
impl Send for FormatSizeOptions
impl Sync for FormatSizeOptions
impl Unpin for FormatSizeOptions
impl UnwindSafe for FormatSizeOptions
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