Get

Trait Get 

Source
pub trait Get {
    type Error;
    type Input;
    type Output<'output>
       where Self: 'output;

    // Required method
    fn get(&self, input: Self::Input) -> Result<Self::Output<'_>, Self::Error>;
}
Expand description

See Get::get for more information.

Required Associated Types§

Source

type Error

Error

Source

type Input

Input

Source

type Output<'output> where Self: 'output

Output

Required Methods§

Source

fn get(&self, input: Self::Input) -> Result<Self::Output<'_>, Self::Error>

Returns an immutable inner reference of a derived element.

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<T> Get for &[T]

let structure = cl_aux::doc_tests::slice();
assert_eq!(cl_aux::Get::get(&structure, 0), Ok(&1));
Source§

type Error = Error

Source§

type Input = usize

Source§

type Output<'output> = &'output T where Self: 'output

Source§

fn get(&self, input: Self::Input) -> Result<Self::Output<'_>, Self::Error>

Source§

impl<T> Get for &mut [T]

let mut structure = cl_aux::doc_tests::slice_mut!();
assert_eq!(cl_aux::Get::get(&mut structure, 0), Ok(&1));
Source§

type Error = Error

Source§

type Input = usize

Source§

type Output<'output> = &'output T where Self: 'output

Source§

fn get(&self, input: Self::Input) -> Result<Self::Output<'_>, Self::Error>

Source§

impl<T> Get for &T
where T: Get,

Source§

type Error = <T as Get>::Error

Source§

type Input = <T as Get>::Input

Source§

type Output<'output> = <T as Get>::Output<'output> where Self: 'output

Source§

fn get(&self, input: Self::Input) -> Result<Self::Output<'_>, Self::Error>

Source§

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

let structure = cl_aux::doc_tests::array();
assert_eq!(cl_aux::Get::get(&structure, 0), Ok(&1));
Source§

type Error = Error

Source§

type Input = usize

Source§

type Output<'output> = &'output T where Self: 'output

Source§

fn get(&self, input: Self::Input) -> Result<Self::Output<'_>, Self::Error>

Implementors§

Source§

impl<T> Get for SingleItemStorage<T>

let structure = cl_aux::doc_tests::single_item_storage();
assert_eq!(cl_aux::Get::get(&structure, 0), Ok(&1));
Source§

type Error = Error

Source§

type Input = usize

Source§

type Output<'output> = &'output T where Self: 'output