Skip to main content

RestorableDateTime

Struct RestorableDateTime 

Source
pub struct RestorableDateTime { /* private fields */ }
Expand description

A RestorableValue that knows how to save and restore a DateTime.

The current value of this property is stored in the restoration data as the milliseconds since the epoch. During state restoration the property is restored to the value it had when the restoration data it is getting restored from was collected.

If no restoration data is available, the value is initialized to the default_value given in the constructor.

Implementations§

Source§

impl RestorableDateTime

Source

pub fn new( app: &mut App, default_value: DateTime, ) -> Retained<Handle<RestorableDateTime>>

Creates a RestorableDateTime.

If no restoration data is available to restore the value in this property from, the property will be initialized with the provided default_value.

Trait Implementations§

Source§

impl ChangeNotifier for RestorableDateTime

Source§

fn change_notifier_data(&self) -> &ChangeNotifierData

Source§

fn change_notifier_data_mut(&mut self) -> &mut ChangeNotifierData

Source§

fn will_add_listener(self: Handle<Self>, app: &mut App)

Runs before the listener is stored. Dart overrides of addListener that work before super.addListener go here.
Source§

fn did_remove_listener(self: Handle<Self>, app: &mut App)

Runs after the listener is removed. Dart overrides of removeListener that work after super.removeListener go here.
Source§

impl RestorableProperty for RestorableDateTime

Source§

type Value = DateTime

The object this property wraps; Dart’s type argument T.
Source§

fn restorable_property_data( self: Handle<RestorableDateTime>, app: &App, ) -> &RestorablePropertyData

The registration with a RestorationMixin, held under the field property (restorable_property_accessors!).
Source§

fn restorable_property_data_mut( self: Handle<RestorableDateTime>, app: &mut App, ) -> &mut RestorablePropertyData

Source§

fn create_default_value( self: Handle<RestorableDateTime>, app: &mut App, ) -> DateTime

Called by the RestorationMixin if no restoration data is available to restore the value of the property from, to obtain the default value for the property. Read more
Source§

fn from_primitives( self: Handle<RestorableDateTime>, _app: &mut App, data: &RestorationData, ) -> DateTime

Called by the RestorationMixin to convert the data previously retrieved from to_primitives back into an object of type Value that this property should wrap. Read more
Source§

fn init_with_value( self: Handle<RestorableDateTime>, app: &mut App, value: DateTime, )

Called by the RestorationMixin with the value returned by either create_default_value or from_primitives to set the value that this property currently wraps. Read more
Source§

fn to_primitives(self: Handle<RestorableDateTime>, app: &App) -> RestorationData

Called by the RestorationMixin to retrieve the information that this property wants to store in the restoration data. Read more
Source§

fn enabled(self: Handle<Self>, app: &App) -> bool

Whether the object currently returned by to_primitives should be included in the restoration state. Read more
Source§

fn dispose_property(self: Handle<Self>, app: &mut App)

Dart’s RestorableProperty.dispose body. An override that runs super.dispose() calls this.
Source§

fn dispose(self: Handle<Self>, app: &mut App)

Discards any resources used by the property, unregistering it from its owner.
Source§

fn did_dispose(self: Handle<Self>, app: &mut App)

Runs at the end of dispose: what a Dart override does after its super.dispose() call.
Source§

fn state(self: Handle<Self>, app: &App) -> AnyRestorationMixin

The State object that this property is registered with. Read more
Source§

fn is_registered(self: Handle<Self>, app: &App) -> bool

Whether this property is currently registered with a RestorationMixin.
Source§

fn as_property(self: Handle<Self>) -> AnyRestorableProperty

This property as the erased AnyRestorableProperty — what to pass where a Dart API takes a RestorableProperty<Object?>.
Source§

impl RestorableValue for RestorableDateTime

Source§

fn restorable_value_data( self: Handle<RestorableDateTime>, app: &App, ) -> &RestorableValueData<<RestorableDateTime as RestorableProperty>::Value>

Dart’s RestorableValue._value, held under the field value (restorable_value_accessors!).
Source§

fn restorable_value_data_mut( self: Handle<RestorableDateTime>, app: &mut App, ) -> &mut RestorableValueData<<RestorableDateTime as RestorableProperty>::Value>

Source§

fn did_update_value( self: Handle<RestorableDateTime>, app: &mut App, old_value: Option<DateTime>, )

Called whenever a new value is assigned to value. Read more
Source§

fn value(self: Handle<Self>, app: &App) -> &Self::Value

The current value stored in this property. Read more
Source§

fn set_value(self: Handle<Self>, app: &mut App, new_value: Self::Value)

Replaces value, calling did_update_value when it changes.
Source§

fn init_with_value(self: Handle<Self>, app: &mut App, value: Self::Value)

Dart’s RestorableValue.initWithValue: the value the RestorationMixin restored or defaulted becomes value.
Source§

fn debug_assert_valid_value( self: Handle<Self>, app: &App, new_value: &Self::Value, ) -> bool

Checks what Dart asserts inside a set value override before running the inherited setter; RestorableEnum and RestorableEnumN check membership in their values. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for RestorableDateTime

§

impl !Send for RestorableDateTime

§

impl !Sync for RestorableDateTime

§

impl !UnwindSafe for RestorableDateTime

§

impl Forget for RestorableDateTime

§

impl Freeze for RestorableDateTime
where *const u8 is !null: Freeze, PhantomData<Option<Listener>>: Freeze, *const RcInner<Cell<usize>> is !null: Freeze, PhantomData<RcInner<Cell<usize>>>: Freeze, PhantomData<u8>: Freeze, NonZero<u32>: Freeze, &'static RestorationMixinVTable: Freeze,

§

impl Move for RestorableDateTime

§

impl Unpin for RestorableDateTime
where *const u8 is !null: Unpin, Rc<dyn Fn(&mut App)>: Unpin, NonZero<u32>: Unpin, *const (): Unpin, Rc<Cell<usize>>: Unpin, &'static RestorationMixinVTable: Unpin,

§

impl UnsafeUnpin for RestorableDateTime
where *const u8 is !null: UnsafeUnpin, PhantomData<Option<Listener>>: UnsafeUnpin, *const RcInner<Cell<usize>> is !null: UnsafeUnpin, PhantomData<RcInner<Cell<usize>>>: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, NonZeroU32Inner: UnsafeUnpin, &'static RestorationMixinVTable: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast for T
where T: Any,

Source§

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.
Source§

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.
Source§

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.
Source§

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.
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ListenableObject for T
where T: ChangeNotifier,

Source§

fn add_listener(self: Handle<T>, app: &mut App, listener: Listener)

Register a closure to be called when the object notifies its listeners.
Source§

fn remove_listener(self: Handle<T>, app: &mut App, listener: &Listener)

Remove a previously registered closure from the list of closures that the object notifies.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more