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§
Provided Methods§
Sourcefn collection_capacity(&self) -> Result<usize, NotAvailable> ⓘ
fn collection_capacity(&self) -> Result<usize, NotAvailable> ⓘ
Returns the reserved capacity for elements in the collection.
Sourcefn collection_len(&self) -> Result<usize, NotAvailable> ⓘ
fn collection_len(&self) -> Result<usize, NotAvailable> ⓘ
Returns the current number of elements in the collection.
Sourcefn collection_is_empty(&self) -> Result<bool, NotAvailable> ⓘ
fn collection_is_empty(&self) -> Result<bool, NotAvailable> ⓘ
Returns true
if the collection is empty, false
if it’s not.
Sourcefn collection_is_full(&self) -> Result<bool, NotAvailable> ⓘ
fn collection_is_full(&self) -> Result<bool, NotAvailable> ⓘ
Returns true
if the collection is full, false
if it’s not.
Sourcefn collection_contains(
&self,
element: Self::Element,
) -> Result<bool, NotAvailable> ⓘ
fn collection_contains( &self, element: Self::Element, ) -> Result<bool, NotAvailable> ⓘ
Returns true
if the collection contains the given element
.
Sourcefn collection_count(
&self,
element: &Self::Element,
) -> Result<usize, NotAvailable> ⓘ
fn collection_count( &self, element: &Self::Element, ) -> Result<usize, NotAvailable> ⓘ
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]
impl<T, const N: usize> DataCollection for [T; N]
Source§fn collection_is_empty(&self) -> Result<bool, NotAvailable> ⓘ
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> ⓘ
fn collection_is_full(&self) -> Result<bool, NotAvailable> ⓘ
Returns [NotSupported
][E::NotSupported] since a fixed-size array is never empty or full.