macro_rules! map_entry_for {
($(#[$attr:meta])* $name:ident) => { ... };
($(#[$attr:meta])* $name:ident { key = $key:ty }) => { ... };
($(#[$attr:meta])* $name:ident { entry = $entry:ident }) => { ... };
($(#[$attr:meta])* $name:ident { key = $key:ty, entry = $entry:ident }) => { ... };
($(#[$attr:meta])* $name:ident { entry = $entry:ident, key = $key:ty }) => { ... };
}
Expand description
Creates a new entry type implementing GraphQLMapEntry for the given type.
§Examples
#[derive(Clone)]
pub struct MyType;
graphql_starter::map_entry_for!(
#[derive(Clone)]
MyType
);
Expands to:
ⓘ
#[derive(Clone)]
pub struct MyTypeEntry {
pub key: String,
pub value: MyType,
}
You can also configure the key type or the entry type name:
map_entry_for!(MyType { key = u32 });
map_entry_for!(MyType { entry = MyCustomTypeEntry });
map_entry_for!(MyType { key = &'static str, entry = MyEntry });