pub enum Style {
OneUnitFrac,
OneUnitWhole,
TwoUnitsWhole,
}Expand description
Formatting style for std::time::Duration.
Variants§
OneUnitFrac
Format the duration in the largest possible unit with a fractional part with 3 significant digits.
§Example
use std::time::Duration;
use folktime::Folktime;
use folktime::duration::Style;
let d = Folktime::duration(Duration::from_secs(123)).with_style(Style::OneUnitFrac);
assert_eq!(format!("{}", d), "2.05m");OneUnitWhole
Format the duration in the largest possible unit with a whole number.
§Example
use std::time::Duration;
use folktime::Folktime;
use folktime::duration::Style;
let d = Folktime::duration(Duration::from_secs(123)).with_style(Style::OneUnitWhole);
assert_eq!(format!("{}", d), "2m");TwoUnitsWhole
Format the duration in the two largest possible units with whole numbers.
§Example
use std::time::Duration;
use folktime::Folktime;
use folktime::duration::Style;
let d = Folktime::duration(Duration::from_secs(123)).with_style(Style::TwoUnitsWhole);
assert_eq!(format!("{}", d), "2m 3s");Trait Implementations§
Auto Trait Implementations§
impl Freeze for Style
impl RefUnwindSafe for Style
impl Send for Style
impl Sync for Style
impl Unpin for Style
impl UnwindSafe for Style
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