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>,
impl<'d, T> PostcardValue<T>where
T: Serialize + Deserialize<'d>,
pub const fn from(value: T) -> PostcardValue<T>
pub const fn from(value: T) -> PostcardValue<T>
Wraps an object in a PostcardValue
.
pub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Turns this PostcardValue
into the wrapped object.
Trait Implementations§
§impl<T> Debug for PostcardValue<T>where
T: Debug,
impl<T> Debug for PostcardValue<T>where
T: Debug,
§impl<T> Deref for PostcardValue<T>
impl<T> Deref for PostcardValue<T>
§impl<'d, T> From<T> for PostcardValue<T>where
T: Serialize + Deserialize<'d>,
impl<'d, T> From<T> for PostcardValue<T>where
T: Serialize + Deserialize<'d>,
§fn from(other: T) -> PostcardValue<T>
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>,
impl<'d, T> Value<'d> for PostcardValue<T>where
T: Serialize + Deserialize<'d>,
§fn serialize_into(&self, buffer: &mut [u8]) -> Result<usize, SerializationError>
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>
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> 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