macro_rules! make_context_ty { ($context_name:ident, $empty_context_name:ident, $type:ty $(, $types:ty)* $(,)* ) => { ... }; ($context_name:ident, $empty_context_name:ident $(,)* ) => { ... }; }
Expand description
Macro for easily defining context types. The first argument should be a
context type created with new_context_type!
and subsequent arguments are the
types to be stored in the context, with the outermost first.
// the following two types are identical
type ExampleContext1 = make_context_ty!(MyContext, MyEmptyContext, Type1, Type2, Type3);
type ExampleContext2 = MyContext<Type1, MyContext<Type2, MyContext<Type3, MyEmptyContext>>>;
// e.g. this wouldn't compile if they were different types
fn do_nothing(input: ExampleContext1) -> ExampleContext2 {
input
}