puffin_build/library/build/
options.rs1use std::collections::HashMap;
2
3use serde::{Deserialize, Serialize};
4
5use crate::utils::Value;
6
7#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
8pub struct Options(HashMap<String, Value>);
9
10impl Options {
11 pub fn insert(&mut self, name: impl Into<String>, value: impl Into<Value>) {
12 self.0.insert(name.into(), value.into());
13 }
14}
15
16impl<'a> IntoIterator for &'a Options {
17 type IntoIter = std::collections::hash_map::Iter<'a, String, Value>;
18 type Item = (&'a String, &'a Value);
19
20 fn into_iter(self) -> Self::IntoIter {
21 self.0.iter()
22 }
23}
24
25impl AsRef<Options> for Options {
26 fn as_ref(&self) -> &Options {
27 self
28 }
29}