#[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
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.base_unit: BaseUnitWhether the value being formatted represents an amount of bits or bytes.
kilo: KiloThe scale (binary/decimal) to divide against.
units: KiloThe unit set to display.
decimal_places: usizeThe amount of decimal places to display if the decimal part is non-zero.
decimal_zeroes: usizeThe 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: boolWhether to use the full unit (e.g. Kilobyte) or its abbreviation (kB).
space_after_value: boolWhether to place a space between value and units.
suffix: &'static strAn optional suffix which will be appended after the unit. Useful to represent speeds (e.g. `1 kB/s)
Implementations§
Source§impl FormatSizeOptions
impl 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
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
Source§impl Clone for FormatSizeOptions
impl Clone for FormatSizeOptions
Source§fn clone(&self) -> FormatSizeOptions
fn clone(&self) -> FormatSizeOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 40 bytes