[][src]Struct pushrod::widget::config::Configurable

pub struct Configurable { /* fields omitted */ }

Default Configurable object, created for each struct represented in the impl_configurable! macro.

Methods

impl Configurable[src]

Implementation of the default Configurable object.

There are two ways in which configuration objects can be used:

fn main() {
  let mut config: Configurable = Configurable::new();

  config.set(Origin(Point { x: 0, y: 100 }));
  config.set(BodySize(Size { w: 150, h: 150 }));

  // To get the value of the Origin, you can use type inference:
  let main_origin: &Origin = config.get().unwrap();

  // Or you can use declared types with ::<> as such:
  let body_size = &config.get::<BodySize>().unwrap().0;
}

pub fn new() -> Self[src]

pub fn set<T: ConfigKey>(&mut self, value: T)[src]

pub fn get<T: ConfigKey>(&self) -> Option<&T>[src]

pub fn remove<T: ConfigKey>(&mut self)[src]

pub fn contains_key<T: ConfigKey>(&self) -> bool[src]

Trait Implementations

impl Default for Configurable[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> SetParameter for T

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
    T: Parameter<Self>, 

Sets value as a parameter of self.

impl<T> Erased for T