pub struct SledEventTree<T> { /* private fields */ }Expand description
Direct singular key-value of T table
Implementations§
Source§impl<T> SledEventTree<T>
impl<T> SledEventTree<T>
Source§impl<T> SledEventTree<T>where
T: Serialize + DeserializeOwned,
DB “Tables” functionality
impl<T> SledEventTree<T>where
T: Serialize + DeserializeOwned,
DB “Tables” functionality
Sourcepub fn contains_key(&self, id: u64) -> Result<bool, Error>
pub fn contains_key(&self, id: u64) -> Result<bool, Error>
check if sprovided u64 key is present in the db
Sourcepub fn contains_value(&self, value: &T) -> boolwhere
T: PartialEq,
pub fn contains_value(&self, value: &T) -> boolwhere
T: PartialEq,
check if value T is present in the db
Sourcepub fn insert(&self, key: u64, value: &T) -> Result<(), Error>
pub fn insert(&self, key: u64, value: &T) -> Result<(), Error>
insert T with given key
Warning! This will rewrite existing value with the same key
Sourcepub fn iter(&self) -> impl DoubleEndedIterator<Item = T>
pub fn iter(&self) -> impl DoubleEndedIterator<Item = T>
iterator over T deserialized from the db
Sourcepub fn get_next_key(&self) -> u64
pub fn get_next_key(&self) -> u64
provides which u64 key to use to add NEW entry
Sourcepub fn get_key_by_value(&self, value: &T) -> Result<Option<u64>, Error>where
T: Serialize,
pub fn get_key_by_value(&self, value: &T) -> Result<Option<u64>, Error>where
T: Serialize,
somewhat expensive! gets optional u64 key for given &T
if present in the db
Sourcepub fn designated_key(&self, identifier: &T) -> u64where
T: Serialize,
pub fn designated_key(&self, identifier: &T) -> u64where
T: Serialize,
combination of get_key_by_value() and get_next_key()
also expensive…
to be used when unsure if identifier is present in the db
Auto Trait Implementations§
impl<T> Freeze for SledEventTree<T>
impl<T> !RefUnwindSafe for SledEventTree<T>
impl<T> Send for SledEventTree<T>where
T: Send,
impl<T> Sync for SledEventTree<T>where
T: Sync,
impl<T> Unpin for SledEventTree<T>where
T: Unpin,
impl<T> !UnwindSafe for SledEventTree<T>
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