Add derive(Default) to HashMapContext

This commit is contained in:
Sebastian Schmidt 2019-03-28 15:44:25 +01:00
parent e8578bf175
commit c63206fa17
2 changed files with 3 additions and 6 deletions

View File

@ -19,7 +19,7 @@
### Added ### Added
* Add serde support to `HashMapContext` * Add serde support to `HashMapContext`
* Make `HashMapContext` derive default * Make `HashMapContext` derive `Default` and `Debug`
### Changed ### Changed

View File

@ -49,7 +49,7 @@ impl Context for EmptyContext {
/// *Value and function mappings are stored independently, meaning that there can be a function and a value with the same identifier.* /// *Value and function mappings are stored independently, meaning that there can be a function and a value with the same identifier.*
/// ///
/// This context is type-safe, meaning that an identifier that is assigned a value of some type once cannot be assigned a value of another type. /// This context is type-safe, meaning that an identifier that is assigned a value of some type once cannot be assigned a value of another type.
#[derive(Debug)] #[derive(Debug, Default)]
#[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))] #[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))]
pub struct HashMapContext { pub struct HashMapContext {
variables: HashMap<String, Value>, variables: HashMap<String, Value>,
@ -60,10 +60,7 @@ pub struct HashMapContext {
impl HashMapContext { impl HashMapContext {
/// Constructs a `HashMapContext` with no mappings. /// Constructs a `HashMapContext` with no mappings.
pub fn new() -> Self { pub fn new() -> Self {
Self { Default::default()
variables: Default::default(),
functions: Default::default(),
}
} }
} }