pub struct Shmap { /* private fields */ }Implementations
sourceimpl Shmap
impl Shmap
sourcepub fn new_with_encryption(encryption_key: &[u8; 32]) -> Self
pub fn new_with_encryption(encryption_key: &[u8; 32]) -> Self
Initialize Shmap with AES256 encryption key (random bytes).
sourcepub fn get<T>(&self, key: &str) -> Result<Option<T>, ShmapError> where
T: DeserializeOwned,
pub fn get<T>(&self, key: &str) -> Result<Option<T>, ShmapError> where
T: DeserializeOwned,
Get an item value by its key, and deserialize it (using bincode) to T.
sourcepub fn get_raw(&self, key: &str) -> Result<Option<Vec<u8>>, ShmapError>
pub fn get_raw(&self, key: &str) -> Result<Option<Vec<u8>>, ShmapError>
Get an item by its key, without deserialization, as bytes.
sourcepub fn insert<T>(&self, key: &str, value: T) -> Result<(), ShmapError> where
T: Serialize,
pub fn insert<T>(&self, key: &str, value: T) -> Result<(), ShmapError> where
T: Serialize,
Insert a new item, using bincode serialization.
sourcepub fn insert_with_ttl<T>(
&self,
key: &str,
value: T,
ttl: Duration
) -> Result<(), ShmapError> where
T: Serialize,
pub fn insert_with_ttl<T>(
&self,
key: &str,
value: T,
ttl: Duration
) -> Result<(), ShmapError> where
T: Serialize,
Insert a new item, using bincode serialization, with a TTL.
sourcepub fn insert_raw_with_ttl(
&self,
key: &str,
value: &[u8],
ttl: Duration
) -> Result<(), ShmapError>
pub fn insert_raw_with_ttl(
&self,
key: &str,
value: &[u8],
ttl: Duration
) -> Result<(), ShmapError>
Insert a new item, without serialization, with a TTL.
sourcepub fn insert_raw(&self, key: &str, value: &[u8]) -> Result<(), ShmapError>
pub fn insert_raw(&self, key: &str, value: &[u8]) -> Result<(), ShmapError>
Insert a new item, without serialization.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Shmap
impl Send for Shmap
impl Sync for Shmap
impl Unpin for Shmap
impl UnwindSafe for Shmap
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more