pub struct FluentDateTime(pub Timestamp);Expand description
Wrapper for a jiff [Timestamp] that automatically converts to Fluent’s expected millisecond format.
While this wrapper can be used, [Timestamp] and [ZonedDateTime] implement Res directly,
so you can pass them to arg() without wrapping. A [ZonedDateTime] is converted to the instant it denotes,
so its time zone does not affect the formatted value.
§Example
ⓘ
let now = Timestamp::now();
// Timestamps work directly with arg()
Label::new(cx, Localized::new("event-date").arg("date", now));Tuple Fields§
§0: TimestampTrait Implementations§
Source§impl Clone for FluentDateTime
impl Clone for FluentDateTime
Source§fn clone(&self) -> FluentDateTime
fn clone(&self) -> FluentDateTime
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for FluentDateTime
Source§impl Debug for FluentDateTime
impl Debug for FluentDateTime
Source§impl PartialEq for FluentDateTime
impl PartialEq for FluentDateTime
Source§impl Res<FluentDateTime> for FluentDateTime
impl Res<FluentDateTime> for FluentDateTime
Source§fn get_value(&self, _: &impl DataContext) -> FluentDateTime
fn get_value(&self, _: &impl DataContext) -> FluentDateTime
Returns the value of a resource by value.
fn set_or_bind<F>(self, cx: &mut Context, closure: F)
Source§impl Res<FluentDateTime> for Timestamp
impl Res<FluentDateTime> for Timestamp
Source§fn get_value(&self, _: &impl DataContext) -> FluentDateTime
fn get_value(&self, _: &impl DataContext) -> FluentDateTime
Returns the value of a resource by value.
fn set_or_bind<F>(self, cx: &mut Context, closure: F)
Source§impl Res<FluentDateTime> for ZonedDateTime
impl Res<FluentDateTime> for ZonedDateTime
Source§fn get_value(&self, _: &impl DataContext) -> FluentDateTime
fn get_value(&self, _: &impl DataContext) -> FluentDateTime
Returns the value of a resource by value.
fn set_or_bind<F>(self, cx: &mut Context, closure: F)
impl StructuralPartialEq for FluentDateTime
Auto Trait Implementations§
impl Freeze for FluentDateTime
impl RefUnwindSafe for FluentDateTime
impl Send for FluentDateTime
impl Sync for FluentDateTime
impl Unpin for FluentDateTime
impl UnsafeUnpin for FluentDateTime
impl UnwindSafe for FluentDateTime
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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.