Macro swagger::make_context
source · [−]macro_rules! make_context {
($context_name:ident, $empty_context_name:ident, $value:expr $(, $values:expr)* $(,)*) => { ... };
($context_name:ident, $empty_context_name:ident $(,)* ) => { ... };
}
Expand description
Macro for easily defining context values. The first argument should be a
context type created with new_context_type!
and subsequent arguments are the
values to be stored in the context, with the outermost first.
fn main() {
// the following are equivalent
let context1 = make_context!(MyContext, MyEmptyContext, Type1 {}, Type2 {}, Type3 {});
let context2 = MyEmptyContext::default()
.push(Type3{})
.push(Type2{})
.push(Type1{});
assert_eq!(context1, context2);
}