Trait IDCollection

Source
pub trait IDCollection<ID: IDLike> {
    // Required method
    fn get_id<T: Borrow<str> + Display + ?Sized>(&self, id: &T) -> Result<&ID>;
}
Expand description

A data structure containing a set of IDs

Required Methods§

Source

fn get_id<T: Borrow<str> + Display + ?Sized>(&self, id: &T) -> Result<&ID>

Check if the ID is in the collection, returning a copy of it if found.

§Arguments
  • id - The ID to check (can be string or ID type)
§Returns

A copy of the ID in self, or an error if not found.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<ID: IDLike> IDCollection<ID> for HashSet<ID>

Source§

fn get_id<T: Borrow<str> + Display + ?Sized>(&self, id: &T) -> Result<&ID>

Source§

impl<ID: IDLike> IDCollection<ID> for IndexSet<ID>

Source§

fn get_id<T: Borrow<str> + Display + ?Sized>(&self, id: &T) -> Result<&ID>

Source§

impl<ID: IDLike, V> IDCollection<ID> for IndexMap<ID, V>

Source§

fn get_id<T: Borrow<str> + Display + ?Sized>(&self, id: &T) -> Result<&ID>

Implementors§