ariel_os::storage

Struct PostcardValue

pub struct PostcardValue<T> { /* private fields */ }
Available on crate feature storage only.
Expand description

A [Value] serialized using Postcard.

Implementations§

§

impl<'d, T> PostcardValue<T>
where T: Serialize + Deserialize<'d>,

pub const fn from(value: T) -> PostcardValue<T>

Wraps an object in a PostcardValue.

pub fn into_inner(self) -> T

Turns this PostcardValue into the wrapped object.

Trait Implementations§

§

impl<T> Debug for PostcardValue<T>
where T: Debug,

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<T> Deref for PostcardValue<T>

§

type Target = T

The resulting type after dereferencing.
§

fn deref(&self) -> &<PostcardValue<T> as Deref>::Target

Dereferences the value.
§

impl<'d, T> From<T> for PostcardValue<T>
where T: Serialize + Deserialize<'d>,

§

fn from(other: T) -> PostcardValue<T>

Converts to this type from the input type.
§

impl<'d, T> Value<'d> for PostcardValue<T>
where T: Serialize + Deserialize<'d>,

§

fn serialize_into(&self, buffer: &mut [u8]) -> Result<usize, SerializationError>

Serialize the value into the given buffer. If everything went ok, this function returns the length of the used part of the buffer.
§

fn deserialize_from( buffer: &'d [u8], ) -> Result<PostcardValue<T>, SerializationError>

Deserialize the value from the buffer. Because of the added lifetime, the implementation can borrow from the buffer which opens up some zero-copy possibilities. Read more

Auto Trait Implementations§

§

impl<T> Freeze for PostcardValue<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for PostcardValue<T>
where T: RefUnwindSafe,

§

impl<T> Send for PostcardValue<T>
where T: Send,

§

impl<T> Sync for PostcardValue<T>
where T: Sync,

§

impl<T> Unpin for PostcardValue<T>
where T: Unpin,

§

impl<T> UnwindSafe for PostcardValue<T>
where T: UnwindSafe,

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

§

const WITNESS: W = W::MAKE

A constant of the type witness
§

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

§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V