[][src]Trait splinter::storage::sets::DurableSet

pub trait DurableSet: Send + Sync {
    type Item: Send;
    fn add(&mut self, item: Self::Item) -> Result<(), DurableSetError>;
fn remove(
        &mut self,
        item: &Self::Item
    ) -> Result<Option<Self::Item>, DurableSetError>;
fn contains(&self, item: &Self::Item) -> Result<bool, DurableSetError>;
fn iter<'a>(
        &'a self
    ) -> Result<Box<dyn Iterator<Item = Self::Item> + 'a>, DurableSetError>;
fn len(&self) -> Result<u64, DurableSetError>; fn is_empty(&self) -> Result<bool, DurableSetError> { ... } }

A Durable Set.

This trait provides an API for interacting with Durable sets that may be backed by a wide variety of persistent storage.

Associated Types

type Item: Send

Loading content...

Required methods

fn add(&mut self, item: Self::Item) -> Result<(), DurableSetError>

Add an item to the set.

fn remove(
    &mut self,
    item: &Self::Item
) -> Result<Option<Self::Item>, DurableSetError>

Remove an item to the set.

fn contains(&self, item: &Self::Item) -> Result<bool, DurableSetError>

Get a value based on the query item.

fn iter<'a>(
    &'a self
) -> Result<Box<dyn Iterator<Item = Self::Item> + 'a>, DurableSetError>

Returns an iterator over the contents of the set.

fn len(&self) -> Result<u64, DurableSetError>

Returns the count of the values in the set.

Loading content...

Provided methods

Loading content...

Implementors

impl<V> DurableSet for DurableBTreeSet<V> where
    V: Send + Ord + Clone
[src]

type Item = V

fn add(&mut self, item: Self::Item) -> Result<(), DurableSetError>[src]

Add an item to the set.

fn remove(
    &mut self,
    item: &Self::Item
) -> Result<Option<Self::Item>, DurableSetError>
[src]

Remove an item to the set.

impl<V: Send + Hash + Eq + Clone> DurableSet for DurableHashSet<V>[src]

type Item = V

fn add(&mut self, item: Self::Item) -> Result<(), DurableSetError>[src]

Add an item to the set.

fn remove(
    &mut self,
    item: &Self::Item
) -> Result<Option<Self::Item>, DurableSetError>
[src]

Remove an item to the set.

Loading content...