Skip to main content

RestorablePrimitive

Trait RestorablePrimitive 

Source
pub trait RestorablePrimitive:
    Clone
    + PartialEq
    + 'static {
    // Required methods
    fn from_restoration_data(data: &RestorationData) -> Self;
    fn to_restoration_data(&self) -> RestorationData;
}
Expand description

A value that is stored in the restoration data as one RestorationData; Dart’s cast serialized as T in _RestorablePrimitiveValueN.fromPrimitives.

Implemented for the primitives a RestorationBucket can hold and for Option of each of them, which is the nullable half of Dart’s primitive property pairs.

Required Methods§

Source

fn from_restoration_data(data: &RestorationData) -> Self

Dart’s serialized as T; panics when the stored data is of another kind, which is what Dart’s failing cast does.

Source

fn to_restoration_data(&self) -> RestorationData

The value as it is stored in the restoration data.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl RestorablePrimitive for String

Source§

impl RestorablePrimitive for bool

Source§

impl RestorablePrimitive for f64

Source§

impl RestorablePrimitive for i64

Source§

impl<T> RestorablePrimitive for Option<T>

Implementors§