pub struct AppendStoreMut<'a, T, S, Ser = Bincode2> where
T: Serialize + DeserializeOwned,
S: Storage,
Ser: Serde, { /* private fields */ }
Expand description
A type allowing both reads from and writes to the append store at a given storage location.
Implementations
sourceimpl<'a, T, S> AppendStoreMut<'a, T, S, Bincode2> where
T: Serialize + DeserializeOwned,
S: Storage,
impl<'a, T, S> AppendStoreMut<'a, T, S, Bincode2> where
T: Serialize + DeserializeOwned,
S: Storage,
sourcepub fn attach_or_create(storage: &'a mut S) -> StdResult<Self>
pub fn attach_or_create(storage: &'a mut S) -> StdResult<Self>
Try to use the provided storage as an AppendStore. If it doesn’t seem to be one, then initialize it as one.
Returns Err if the contents of the storage can not be parsed.
sourceimpl<'a, T, S, Ser> AppendStoreMut<'a, T, S, Ser> where
T: Serialize + DeserializeOwned,
S: Storage,
Ser: Serde,
impl<'a, T, S, Ser> AppendStoreMut<'a, T, S, Ser> where
T: Serialize + DeserializeOwned,
S: Storage,
Ser: Serde,
sourcepub fn attach_or_create_with_serialization(
storage: &'a mut S,
_ser: Ser
) -> StdResult<Self>
pub fn attach_or_create_with_serialization(
storage: &'a mut S,
_ser: Ser
) -> StdResult<Self>
Try to use the provided storage as an AppendStore. If it doesn’t seem to be one, then initialize it as one. This method allows choosing the serialization format you want to use.
Returns Err if the contents of the storage can not be parsed.
sourcepub fn attach_with_serialization(
storage: &'a mut S,
_ser: Ser
) -> Option<StdResult<Self>>
pub fn attach_with_serialization(
storage: &'a mut S,
_ser: Ser
) -> Option<StdResult<Self>>
Try to use the provided storage as an AppendStore. This method allows choosing the serialization format you want to use.
Returns None if the provided storage doesn’t seem like an AppendStore. Returns Err if the contents of the storage can not be parsed.
pub fn len(&self) -> u32
pub fn is_empty(&self) -> bool
pub fn storage(&mut self) -> &mut S
pub fn readonly_storage(&self) -> &S
sourcepub fn iter(&self) -> Iter<'_, T, S, Ser>ⓘNotable traits for Iter<'a, T, S, Ser>impl<'a, T, S, Ser> Iterator for Iter<'a, T, S, Ser> where
T: Serialize + DeserializeOwned,
S: ReadonlyStorage,
Ser: Serde, type Item = StdResult<T>;
pub fn iter(&self) -> Iter<'_, T, S, Ser>ⓘNotable traits for Iter<'a, T, S, Ser>impl<'a, T, S, Ser> Iterator for Iter<'a, T, S, Ser> where
T: Serialize + DeserializeOwned,
S: ReadonlyStorage,
Ser: Serde, type Item = StdResult<T>;
T: Serialize + DeserializeOwned,
S: ReadonlyStorage,
Ser: Serde, type Item = StdResult<T>;
Return an iterator over the items in the collection
sourcepub fn get_at(&self, pos: u32) -> StdResult<T>
pub fn get_at(&self, pos: u32) -> StdResult<T>
Get the value stored at a given position.
Errors
Will return an error if pos is out of bounds or if an item is not found.
sourcepub fn set_at(&mut self, pos: u32, item: &T) -> StdResult<()>
pub fn set_at(&mut self, pos: u32, item: &T) -> StdResult<()>
Set the value of the item stored at a given position.
Errors
Will return an error if the position is out of bounds
Trait Implementations
Auto Trait Implementations
impl<'a, T, S, Ser> RefUnwindSafe for AppendStoreMut<'a, T, S, Ser> where
S: RefUnwindSafe,
Ser: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, T, S, Ser = Bincode2> !Send for AppendStoreMut<'a, T, S, Ser>
impl<'a, T, S, Ser = Bincode2> !Sync for AppendStoreMut<'a, T, S, Ser>
impl<'a, T, S, Ser> Unpin for AppendStoreMut<'a, T, S, Ser>
impl<'a, T, S, Ser = Bincode2> !UnwindSafe for AppendStoreMut<'a, T, S, Ser>
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