Struct icu_datetime::FormattedDateTime[][src]

pub struct FormattedDateTime<'l, T> where
    T: DateTimeInput
{ /* fields omitted */ }

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::datetime::mock::datetime::MockDateTime;
use icu_provider::inv::InvariantDataProvider;
let locale: Locale = langid!("en").into();
let dtf = DateTimeFormat::try_new(locale, &provider, &options)
    .expect("Failed to create DateTimeFormat instance.");

let datetime = MockDateTime::try_new(2020, 9, 1, 12, 34, 28)
    .expect("Failed to construct DateTime.");

let formatted_date = dtf.format(&datetime);

let _ = format!("Date: {}", formatted_date);

Trait Implementations

impl<'l, T> Display for FormattedDateTime<'l, T> where
    T: DateTimeInput
[src]

impl<'l, T> Writeable for FormattedDateTime<'l, T> where
    T: DateTimeInput
[src]

Auto Trait Implementations

impl<'l, T> RefUnwindSafe for FormattedDateTime<'l, T> where
    T: RefUnwindSafe

impl<'l, T> Send for FormattedDateTime<'l, T> where
    T: Sync

impl<'l, T> Sync for FormattedDateTime<'l, T> where
    T: Sync

impl<'l, T> Unpin for FormattedDateTime<'l, T>

impl<'l, T> UnwindSafe for FormattedDateTime<'l, T> where
    T: RefUnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.