pub struct FluentDateTime<Tz: TimeZone + Clone>(pub DateTime<Tz>);Expand description
Wrapper for chrono DateTime that automatically converts to Fluent’s expected millisecond format.
While this wrapper can be used, chrono DateTime types implement Res directly,
so you can pass them to arg() without wrapping:
§Example
ⓘ
let now = Utc::now();
// Chrono datetimes work directly with arg()
Label::new(cx, Localized::new("event-date").arg("date", now));Tuple Fields§
§0: DateTime<Tz>Trait Implementations§
Source§impl<Tz: Clone + TimeZone + Clone> Clone for FluentDateTime<Tz>
impl<Tz: Clone + TimeZone + Clone> Clone for FluentDateTime<Tz>
Source§fn clone(&self) -> FluentDateTime<Tz>
fn clone(&self) -> FluentDateTime<Tz>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<Tz: TimeZone + Clone> From<FluentDateTime<Tz>> for FluentValue<'static>
impl<Tz: TimeZone + Clone> From<FluentDateTime<Tz>> for FluentValue<'static>
Source§fn from(val: FluentDateTime<Tz>) -> Self
fn from(val: FluentDateTime<Tz>) -> Self
Converts to this type from the input type.
Source§impl<Tz: TimeZone + Clone + 'static> Res<FluentDateTime<Tz>> for DateTime<Tz>
impl<Tz: TimeZone + Clone + 'static> Res<FluentDateTime<Tz>> for DateTime<Tz>
Source§fn get_value(&self, _: &impl DataContext) -> FluentDateTime<Tz>
fn get_value(&self, _: &impl DataContext) -> FluentDateTime<Tz>
Returns the value of a resource by value.
fn set_or_bind<F>(self, cx: &mut Context, closure: F)
Source§impl<Tz: TimeZone + Clone + 'static> Res<FluentDateTime<Tz>> for FluentDateTime<Tz>
impl<Tz: TimeZone + Clone + 'static> Res<FluentDateTime<Tz>> for FluentDateTime<Tz>
Source§fn get_value(&self, _: &impl DataContext) -> Self
fn get_value(&self, _: &impl DataContext) -> Self
Returns the value of a resource by value.
fn set_or_bind<F>(self, cx: &mut Context, closure: F)
Auto Trait Implementations§
impl<Tz> Freeze for FluentDateTime<Tz>
impl<Tz> RefUnwindSafe for FluentDateTime<Tz>
impl<Tz> Send for FluentDateTime<Tz>
impl<Tz> Sync for FluentDateTime<Tz>
impl<Tz> Unpin for FluentDateTime<Tz>
impl<Tz> UnsafeUnpin for FluentDateTime<Tz>
impl<Tz> UnwindSafe for FluentDateTime<Tz>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.