Function illicit::expect [−][src]
Expand description
Returns a reference to a value in the current environment, as
get
does, but panics if the value has not been set.
The panic message includes the stack of current Layer
s
and their contents.
Examples
let msg = "hello!";
illicit::Layer::new().offer(String::from(msg)).enter(|| {
assert_eq!(&*illicit::expect::<String>(), msg);
});
Panics if the requested type is not in the environment:
ⓘ
println!("{}", &*illicit::expect::<String>());