pub struct Store<B: StoreBackend> { /* private fields */ }Expand description
Simple Flash Key Value Store
Implementations§
Source§impl<B: StoreBackend> Store<B>
impl<B: StoreBackend> Store<B>
Sourcepub fn read_str(&self, key: &str) -> Result<Option<&str>, ReadError>
pub fn read_str(&self, key: &str) -> Result<Option<&str>, ReadError>
read from key, decode UTF-8
Sourcepub fn read_value<'a, T: Deserialize<'a>>(
&'a self,
key: &str,
) -> Result<Option<T>, Error<B::Error>>
pub fn read_value<'a, T: Deserialize<'a>>( &'a self, key: &str, ) -> Result<Option<T>, Error<B::Error>>
read from key, decode with postcard
Sourcepub fn get_bytes_used(&self) -> Result<usize, ReadError>
pub fn get_bytes_used(&self) -> Result<usize, ReadError>
how many bytes are currently used
equally, offset of free space
Sourcepub fn write<V: AsRef<[u8]>>(
&mut self,
key: &str,
value: V,
) -> Result<(), Error<B::Error>>
pub fn write<V: AsRef<[u8]>>( &mut self, key: &str, value: V, ) -> Result<(), Error<B::Error>>
store a buffer value at key
Sourcepub fn write_value<T, V>(
&mut self,
key: &str,
value: &T,
value_buf: V,
) -> Result<(), Error<B::Error>>
pub fn write_value<T, V>( &mut self, key: &str, value: &T, value_buf: V, ) -> Result<(), Error<B::Error>>
encode with postcard, write at key
Auto Trait Implementations§
impl<B> Freeze for Store<B>where
B: Freeze,
impl<B> RefUnwindSafe for Store<B>where
B: RefUnwindSafe,
impl<B> Send for Store<B>where
B: Send,
impl<B> Sync for Store<B>where
B: Sync,
impl<B> Unpin for Store<B>where
B: Unpin,
impl<B> UnwindSafe for Store<B>where
B: 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