Struct icu_datetime::FormattedDateTime
source · [−]pub struct FormattedDateTime<'l, T> where
T: DateTimeInput, { /* private fields */ }
Expand description
FormattedDateTime
is a intermediate structure which can be retrieved as
an output from DateTimeFormat
.
The structure contains all the information needed to display formatted value, and it will also contain additional methods allowing the user to introspect and even manipulate the formatted data.
Examples
use icu::locid::Locale;
use icu::locid::macros::langid;
use icu::datetime::{DateTimeFormat, DateTimeFormatOptions};
use icu::calendar::{DateTime, Gregorian};
use icu_provider::inv::InvariantDataProvider;
let locale: Locale = langid!("en").into();
let dtf = DateTimeFormat::<Gregorian>::try_new(locale, &provider, &options)
.expect("Failed to create DateTimeFormat instance.");
let datetime = DateTime::new_gregorian_datetime_from_integers(2020, 9, 1, 12, 34, 28)
.expect("Failed to construct DateTime.");
let formatted_date = dtf.format(&datetime);
let _ = format!("Date: {}", formatted_date);
Trait Implementations
Writes bytes to the given sink. Errors from the sink are bubbled up. The default implementation delegates to write_to_parts, and discards any Part annotations. Read more
Write bytes and Part annotations to the given sink. Errors from the sink are bubbled up. The default implementation delegates to write_to, and doesn’t produce any Part annotations. Read more
Returns a hint for the number of bytes that will be written to the sink. Read more
Creates a new String with the data from this Writeable. Like ToString, but smaller and faster. Read more
Auto Trait Implementations
impl<'l, T> RefUnwindSafe for FormattedDateTime<'l, T> where
T: RefUnwindSafe,
impl<'l, T> !Send for FormattedDateTime<'l, T>
impl<'l, T> !Sync for FormattedDateTime<'l, T>
impl<'l, T> Unpin for FormattedDateTime<'l, T>
impl<'l, T> UnwindSafe for FormattedDateTime<'l, T> where
T: RefUnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn filterable(
self,
filter_name: &'static str
) -> RequestFilterDataProvider<T, fn(&DataRequest) -> bool>
pub fn filterable(
self,
filter_name: &'static str
) -> RequestFilterDataProvider<T, fn(&DataRequest) -> bool>
Creates a filterable data provider with the given name for debugging. Read more