feat: impl Serialize/Deserialize for ParamsMap (closes #892) (#895)

This commit is contained in:
Daniel Santana 2023-04-19 11:19:53 +01:00 committed by GitHub
parent 72d6af9c84
commit e96f1d2129
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -14,7 +14,7 @@ cfg-if = "1"
common_macros = "0.1"
gloo-net = { version = "0.2", features = ["http"] }
lazy_static = "1"
linear-map = "1"
linear-map = {version = "1", features = ["serde_impl"]}
log = "0.4"
regex = { version = "1", optional = true }
url = { version = "2", optional = true }

View file

@ -1,4 +1,5 @@
use linear_map::LinearMap;
use serde::{Deserialize, Serialize};
use std::{rc::Rc, str::FromStr};
use thiserror::Error;
@ -6,7 +7,7 @@ use thiserror::Error;
// For now, implemented with a `LinearMap`, as `n` is small enough
// that O(n) iteration over a vectorized map is (*probably*) more space-
// and time-efficient than hashing and using an actual `HashMap`
#[derive(Debug, PartialEq, Eq, Clone)]
#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[repr(transparent)]
pub struct ParamsMap(pub LinearMap<String, String>);