devela::all

Trait DataCollection

Source
pub trait DataCollection {
    type Element;

    // Provided methods
    fn collection_capacity(&self) -> Result<usize, NotAvailable>  { ... }
    fn collection_len(&self) -> Result<usize, NotAvailable>  { ... }
    fn collection_is_empty(&self) -> Result<bool, NotAvailable>  { ... }
    fn collection_is_full(&self) -> Result<bool, NotAvailable>  { ... }
    fn collection_contains(
        &self,
        element: Self::Element,
    ) -> Result<bool, NotAvailable> 
       where Self::Element: PartialEq { ... }
    fn collection_count(
        &self,
        element: &Self::Element,
    ) -> Result<usize, NotAvailable> 
       where Self::Element: PartialEq { ... }
}
Expand description

An abstract collection data type.

By default returns [NotImplemented][E::NotImplemented] for every method.

Required Associated Types§

Source

type Element

The element type of the collection.

Provided Methods§

Source

fn collection_capacity(&self) -> Result<usize, NotAvailable>

Returns the reserved capacity for elements in the collection.

Source

fn collection_len(&self) -> Result<usize, NotAvailable>

Returns the current number of elements in the collection.

Source

fn collection_is_empty(&self) -> Result<bool, NotAvailable>

Returns true if the collection is empty, false if it’s not.

Source

fn collection_is_full(&self) -> Result<bool, NotAvailable>

Returns true if the collection is full, false if it’s not.

Source

fn collection_contains( &self, element: Self::Element, ) -> Result<bool, NotAvailable>
where Self::Element: PartialEq,

Returns true if the collection contains the given element.

Source

fn collection_count( &self, element: &Self::Element, ) -> Result<usize, NotAvailable>
where Self::Element: PartialEq,

Counts the number of times a given element appears in the collection.

Implementations on Foreign Types§

Source§

impl<T, const N: usize> DataCollection for [T; N]

Source§

fn collection_is_empty(&self) -> Result<bool, NotAvailable>

Returns [NotSupported][E::NotSupported] since a fixed-size array is never empty or full.

Source§

fn collection_is_full(&self) -> Result<bool, NotAvailable>

Returns [NotSupported][E::NotSupported] since a fixed-size array is never empty or full.

Source§

type Element = T

Source§

fn collection_capacity(&self) -> Result<usize, NotAvailable>

Source§

fn collection_len(&self) -> Result<usize, NotAvailable>

Source§

fn collection_contains( &self, element: Self::Element, ) -> Result<bool, NotAvailable>
where T: PartialEq,

Source§

fn collection_count( &self, element: &Self::Element, ) -> Result<usize, NotAvailable>
where T: PartialEq,

Implementors§

Source§

impl<K, V> DataCollection for BTreeMap<K, V>

Source§

impl<K, V> DataCollection for HashMap<K, V>

Source§

impl<T> DataCollection for BinaryHeap<T>

Source§

impl<T> DataCollection for Vec<T>

Source§

impl<T> DataCollection for VecDeque<T>

Source§

impl<T, const LEN: usize, S: Storage> DataCollection for Array<T, LEN, S>

Source§

impl<T, const LEN: usize, S: Storage> DataCollection for Destaque<T, LEN, u8, S>

Source§

impl<T, const LEN: usize, S: Storage> DataCollection for Destaque<T, LEN, u16, S>

Source§

impl<T, const LEN: usize, S: Storage> DataCollection for Destaque<T, LEN, u32, S>

Source§

impl<T, const LEN: usize, S: Storage> DataCollection for Destaque<T, LEN, usize, S>

Source§

impl<T, const LEN: usize, S: Storage> DataCollection for Stack<T, LEN, u8, S>

Source§

impl<T, const LEN: usize, S: Storage> DataCollection for Stack<T, LEN, u16, S>

Source§

impl<T, const LEN: usize, S: Storage> DataCollection for Stack<T, LEN, u32, S>

Source§

impl<T, const LEN: usize, S: Storage> DataCollection for Stack<T, LEN, usize, S>

Source§

impl<V> DataCollection for BTreeSet<V>

Source§

impl<V> DataCollection for HashSet<V>