macro_rules! static_context_provides {
($struct_name:ty, $field_type:ident, $field_name:ident) => { ... };
($struct_name:ty, $field_type:ident, $field_name:ident, $($further:ident),+) => { ... };
}Expand description
A macro that helps implement ContextProvides for simple struct fields.
This can only be used with fields that don’t use generic parameters, but you can use a type alias to work around this limitation. For example:
use std::collections::HashMap;
use async_codegen::{static_context_provides, context::ContextProvides};
struct MyDetail;
type CodeGenPoints = HashMap<u16, String>;
struct MyContext {
detail: MyDetail,
points: CodeGenPoints
}
static_context_provides!(MyContext, MyDetail, detail, CodeGenPoints, points);