Expand description
A structure to represent the set of lengths in which the DateTimeInput
implementer should be formatted to.
The available lengths correspond to UTS #35: Unicode LDML 4. Dates
, section 2.4 Element dateFormats
.
Examples
use icu::datetime::options::length;
use icu::datetime::DateTimeFormatterOptions;
let bag = length::Bag::from_date_time_style(
length::Date::Medium,
length::Time::Short,
);
let options = DateTimeFormatterOptions::Length(bag);
Or the options can be inferred through the Into
trait.
use icu::datetime::options::length;
use icu::datetime::DateTimeFormatterOptions;
let options: DateTimeFormatterOptions = length::Bag::default().into();
Fields (Non-exhaustive)
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.date: Option<Date>
Configure the date part of the datetime.
time: Option<Time>
Configure the time part of the datetime.
Implementations
sourceimpl Bag
impl Bag
sourcepub fn empty() -> Bag
pub fn empty() -> Bag
Constructs a Bag with all fields set to None
Note that the Default
implementation returns medium date and time options
sourcepub fn from_date_time_style(date: Date, time: Time) -> Bag
pub fn from_date_time_style(date: Date, time: Time) -> Bag
Constructs a Bag given a date and time field
sourcepub fn from_date_style(date: Date) -> Bag
pub fn from_date_style(date: Date) -> Bag
Constructs a Bag given a date field (time set to None)
sourcepub fn from_time_style(time: Time) -> Bag
pub fn from_time_style(time: Time) -> Bag
Constructs a Bag given a time field (date set to None)
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Bag
impl<'de> Deserialize<'de> for Bag
sourcefn deserialize<__D>(
__deserializer: __D
) -> Result<Bag, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Bag, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl From<Bag> for DateTimeFormatterOptions
impl From<Bag> for DateTimeFormatterOptions
sourcefn from(input: Bag) -> DateTimeFormatterOptions
fn from(input: Bag) -> DateTimeFormatterOptions
Converts to this type from the input type.
sourceimpl Serialize for Bag
impl Serialize for Bag
sourcefn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Copy for Bag
impl StructuralPartialEq for Bag
Auto Trait Implementations
impl RefUnwindSafe for Bag
impl Send for Bag
impl Sync for Bag
impl Unpin for Bag
impl UnwindSafe for Bag
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Serialize for T where
T: Serialize + ?Sized,
impl<T> Serialize for T where
T: Serialize + ?Sized,
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<Ok, Error>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more