pub struct Persist<S> { /* private fields */ }Expand description
A utility for persisting a value in a KvBlobStore instance.
Implementations§
Source§impl<S> Persist<S>where
S: KvBlobStoreAccess,
impl<S> Persist<S>where
S: KvBlobStoreAccess,
Sourcepub const fn new(kvb: S) -> Persist<S>
pub const fn new(kvb: S) -> Persist<S>
Create a new Persist instance with the given key-value store instance.
Sourcepub fn store<F>(&mut self, key: u16, f: F) -> Result<(), Error>
pub fn store<F>(&mut self, key: u16, f: F) -> Result<(), Error>
Save a value in the storage with the specified key by calling the provided closure to serialize the value into a buffer.
Sourcepub fn store_tlv<T>(&mut self, key: u16, tlv: T) -> Result<(), Error>where
T: ToTLV,
pub fn store_tlv<T>(&mut self, key: u16, tlv: T) -> Result<(), Error>where
T: ToTLV,
Save a value that implements the ToTLV trait in the storage with the specified key.
Auto Trait Implementations§
impl<S> Freeze for Persist<S>where
S: Freeze,
impl<S> RefUnwindSafe for Persist<S>where
S: RefUnwindSafe,
impl<S> Send for Persist<S>where
S: Send,
impl<S> Sync for Persist<S>where
S: Sync,
impl<S> Unpin for Persist<S>where
S: Unpin,
impl<S> UnsafeUnpin for Persist<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for Persist<S>where
S: 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T, I> IntoFallibleInit<T> for Iwhere
I: Init<T>,
impl<T, I> IntoFallibleInit<T> for Iwhere
I: Init<T>,
Source§fn into_fallible<E>(self) -> impl Init<T, E>
fn into_fallible<E>(self) -> impl Init<T, E>
Convert the infallible initializer to a fallible one.
Source§impl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
impl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
type Error = <Target as OctetsFrom<Source>>::Error
Source§fn try_octets_into(
self,
) -> Result<Target, <Source as OctetsInto<Target>>::Error>
fn try_octets_into( self, ) -> Result<Target, <Source as OctetsInto<Target>>::Error>
Performs the conversion.
Source§fn octets_into(self) -> Target
fn octets_into(self) -> Target
Performs an infallible conversion.