#[non_exhaustive]pub enum FractionalSecondDigits {
F0,
F1,
F2,
F3,
F4,
F5,
F6,
F7,
F8,
F9,
}
Expand description
A specification for how many fractional second digits to display.
For example, to display the time with millisecond precision, use
FractionalSecondDigits::F3
.
Lower-precision digits will be truncated.
§Examples
Times can be displayed with a custom number of fractional digits from 0-9:
use icu::calendar::Gregorian;
use icu::calendar::Time;
use icu::datetime::fieldsets::T;
use icu::datetime::options::FractionalSecondDigits;
use icu::datetime::options::TimePrecision;
use icu::datetime::FixedCalendarDateTimeFormatter;
use icu::locale::locale;
use writeable::assert_writeable_eq;
let formatter = FixedCalendarDateTimeFormatter::<(), _>::try_new(
locale!("en-US").into(),
T::short().with_time_precision(TimePrecision::SecondExact(
FractionalSecondDigits::F2,
)),
)
.unwrap();
assert_writeable_eq!(
formatter.format(&Time::try_new(16, 12, 20, 543200000).unwrap()),
"4:12:20.54 PM"
);
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
F0
Zero fractional digits. This is the default.
F1
One fractional digit (tenths of a second).
F2
Two fractional digits (hundredths of a second).
F3
Three fractional digits (thousandths of a second).
F4
Four fractional digits.
F5
Five fractional digits.
F6
Six fractional digits.
F7
Seven fractional digits.
F8
Eight fractional digits.
F9
Nine fractional digits.
Trait Implementations§
source§impl Clone for FractionalSecondDigits
impl Clone for FractionalSecondDigits
source§fn clone(&self) -> FractionalSecondDigits
fn clone(&self) -> FractionalSecondDigits
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 FractionalSecondDigits
impl Debug for FractionalSecondDigits
source§impl<'de> Deserialize<'de> for FractionalSecondDigits
impl<'de> Deserialize<'de> for FractionalSecondDigits
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl From<FractionalSecondDigits> for u8
impl From<FractionalSecondDigits> for u8
source§fn from(value: FractionalSecondDigits) -> u8
fn from(value: FractionalSecondDigits) -> u8
Converts to this type from the input type.
source§impl Hash for FractionalSecondDigits
impl Hash for FractionalSecondDigits
source§impl PartialEq for FractionalSecondDigits
impl PartialEq for FractionalSecondDigits
source§impl Serialize for FractionalSecondDigits
impl Serialize for FractionalSecondDigits
source§impl TryFrom<u8> for FractionalSecondDigits
impl TryFrom<u8> for FractionalSecondDigits
impl Copy for FractionalSecondDigits
impl Eq for FractionalSecondDigits
impl StructuralPartialEq for FractionalSecondDigits
Auto Trait Implementations§
impl Freeze for FractionalSecondDigits
impl RefUnwindSafe for FractionalSecondDigits
impl Send for FractionalSecondDigits
impl Sync for FractionalSecondDigits
impl Unpin for FractionalSecondDigits
impl UnwindSafe for FractionalSecondDigits
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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>
Converts
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>
Converts
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