Get

Trait Get 

Source
pub trait Get<T> {
    type Key;

    // Required method
    fn get<Q>(&self, index: Q) -> Option<&T>
       where Q: Borrow<Self::Key>;
}
Expand description

Get defines an interface for entities that can be accessed by a key; the design is similar to the Index trait in the standard library, however, uses the Borrow trait to allow for more flexible key types.

Required Associated Types§

Required Methods§

Source

fn get<Q>(&self, index: Q) -> Option<&T>
where Q: Borrow<Self::Key>,

returns a reference to the element at the specified index.

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.

Implementors§