Enum FractionalUnit
enum FractionalUnit
Configuration for SpanPrinter::fractional.
This controls what kind of fractional unit to use when printing a duration.
The default, unless SpanPrinter::hours_minutes_seconds is enabled, is
to not write any fractional numbers at all.
The fractional unit set refers to the smallest whole integer that can occur in a "friendly" formatted duration. If there are any non-zero units less than the fractional unit in the duration, then they are formatted as a fraction.
Example
This example shows how to write the same duration with different fractional settings:
use ;
let duration = from_secs;
let printer = new
.fractional;
assert_eq!;
let printer = new
.fractional;
assert_eq!;
let printer = new
.fractional;
assert_eq!;
Variants
-
Hour The smallest whole integer unit allowed is hours.
WARNING: Since fractional units are limited to 9 decimal places, using this setting could result in precision loss.
-
Minute The smallest whole integer unit allowed is minutes.
WARNING: Since fractional units are limited to 9 decimal places, using this setting could result in precision loss.
-
Second The smallest whole integer unit allowed is seconds.
-
Millisecond The smallest whole integer unit allowed is milliseconds.
-
Microsecond The smallest whole integer unit allowed is microseconds.
Implementations
impl Clone for FractionalUnit
fn clone(self: &Self) -> FractionalUnit
impl Copy for FractionalUnit
impl Debug for FractionalUnit
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl Freeze for FractionalUnit
impl RefUnwindSafe for FractionalUnit
impl Send for FractionalUnit
impl Sync for FractionalUnit
impl Unpin for FractionalUnit
impl UnsafeUnpin for FractionalUnit
impl UnwindSafe for FractionalUnit
impl<T> Any for FractionalUnit
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for FractionalUnit
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for FractionalUnit
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for FractionalUnit
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for FractionalUnit
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for FractionalUnit
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T, U> Into for FractionalUnit
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for FractionalUnit
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for FractionalUnit
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>