1
0

Correct map serialization

This commit is contained in:
Jeff 2023-10-18 17:42:36 -04:00
parent 10af8e4af2
commit a5a87d18e5

View File

@ -6,11 +6,20 @@ use std::{
use crate::{value::Value, Error, Result, Table}; use crate::{value::Value, Error, Result, Table};
impl Serialize for VariableMap {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
self.variables.serialize(serializer)
}
}
/// A collection dust variables comprised of key-value pairs. /// A collection dust variables comprised of key-value pairs.
/// ///
/// The inner value is a BTreeMap in order to allow VariableMap instances to be sorted and compared /// The inner value is a BTreeMap in order to allow VariableMap instances to be sorted and compared
/// to one another. /// to one another.
#[derive(Clone, Debug, PartialEq, PartialOrd, Ord, Eq, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, PartialOrd, Ord, Eq, Deserialize)]
pub struct VariableMap { pub struct VariableMap {
variables: BTreeMap<String, Value>, variables: BTreeMap<String, Value>,
} }