[][src]Trait snec::GetExt

pub trait GetExt {
    fn get_ref_to<E: Entry>(&self) -> &E::Data
    where
        Self: Get<E>
, { ... }
fn get_handle_to<E: Entry>(&mut self) -> Handle<'_, E, Self::Receiver>
    where
        Self: Get<E>
, { ... } }

A convenience trait for using turbofish syntax to get handles to fields in config tables.

Using only Get, getting handles to fields is inconvenient when there is no inference to help you, forcing you to use fully qualified trait call syntax. With GetExt, this becomes much easier:

use snec::GetExt as _;
let mut table = MyConfigTable::default();
// Using the Get trait directly:
let handle = <MyConfigTable as snec::Get<entries::MyEntry>>::get_handle(&mut table);
// Using the GetExt trait:
let handle = table.get_handle_to::<entries::MyEntry>();

Provided methods

fn get_ref_to<E: Entry>(&self) -> &E::Data where
    Self: Get<E>, 

Returns an unguarded immutable reference to the field.

fn get_handle_to<E: Entry>(&mut self) -> Handle<'_, E, Self::Receiver> where
    Self: Get<E>, 

Returns a Handle to the field.

Loading content...

Implementors

impl<T: ?Sized> GetExt for T[src]

Loading content...