Skip to main content

define_collection_wrapper

Macro define_collection_wrapper 

Source
macro_rules! define_collection_wrapper {
    ($(#[$meta:meta])* $name:ident: $(#[$inner_meta:meta])* $inner:path) => { ... };
}
Expand description

Implement a wrapper around a container type (i.e. HashMap). Implements the Deref, DerefMut, Default and IntoIterator/FromIterator traits and the new function.

use cba::define_collection_wrapper;
pub struct Module {};
define_collection_wrapper!(
    #[cfg_attr(feature = "serde", derive(Debug, serde::Serialize, serde::Deserialize))]
    Modules: std::collections::HashMap<String, Module>
);