pub type NoCalendarFormatter<FSet> = FixedCalendarDateTimeFormatter<(), FSet>;
Expand description
A formatter optimized for time and time zone formatting, when a calendar is not needed.
§Examples
A NoCalendarFormatter
can be used to format a time:
use icu::datetime::fieldsets::T;
use icu::datetime::input::Time;
use icu::datetime::NoCalendarFormatter;
use icu::locale::locale;
let formatter =
NoCalendarFormatter::try_new(locale!("bn").into(), T::long()).unwrap();
assert_eq!(
formatter.format(&Time::start_of_day()).to_string(),
"১২:০০:০০ AM"
);
A NoCalendarFormatter
cannot be constructed with a fieldset that involves dates:
use icu::datetime::fieldsets::Y;
use icu::datetime::NoCalendarFormatter;
use icu::locale::locale;
assert!(
NoCalendarFormatter::try_new(locale!("und").into(), Y::medium())
.is_err()
);
Furthermore, it is a compile error in the format function:
ⓘ
use icu::datetime::NoCalendarFormatter;
use icu::datetime::fieldsets::Y;
use icu::locale::locale;
let date: icu::calendar::Date<icu::calendar::Gregorian> = unimplemented!();
let formatter = NoCalendarFormatter::try_new(locale!("und").into(), Y::medium()).unwrap();
// error[E0271]: type mismatch resolving `<Gregorian as AsCalendar>::Calendar == ()`
formatter.format(&date);
Aliased Type§
struct NoCalendarFormatter<FSet> { /* private fields */ }