Function illicit::get[][src]

pub fn get<E>() -> Result<impl Deref<Target = E> + Debug + 'static, GetFailed> where
    E: Any + Debug + 'static, 
Expand description

Returns a reference to a value in the current environment if it is present.


Returns an error if the requested type is not available in the local environment.


let msg = "hello!";
illicit::Layer::new().offer(String::from(msg)).enter(|| {
    assert_eq!(&*illicit::get::<String>().unwrap(), msg);

Returns GetFailed if the requested type is not in the environment: