Type Alias icu_datetime::TimeFormatter

source ·
pub type TimeFormatter<FSet> = FixedCalendarDateTimeFormatter<(), FSet>;
Expand description

A formatter optimized for time and time zone formatting.

§Examples

A TimeFormatter cannot be constructed with a fieldset that involves dates:

use icu::datetime::TimeFormatter;
use icu::datetime::fieldsets::Y;
use icu::locale::locale;

assert!(TimeFormatter::try_new(locale!("und").into(), Y::medium()).is_err());

Furthermore, it is a compile error in the format function:

use icu::datetime::TimeFormatter;
use icu::datetime::fieldsets::Y;
use icu::locale::locale;

let date: icu::calendar::Date<icu::calendar::Gregorian> = unimplemented!();
let formatter = TimeFormatter::try_new(locale!("und").into(), Y::medium()).unwrap();

// error[E0271]: type mismatch resolving `<Gregorian as AsCalendar>::Calendar == ()`
formatter.format(&date);

Aliased Type§

struct TimeFormatter<FSet> { /* private fields */ }