summaryrefslogtreecommitdiff
path: root/src/eval/dict.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/eval/dict.rs')
-rw-r--r--src/eval/dict.rs24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/eval/dict.rs b/src/eval/dict.rs
index 66baaec0..dfac04ed 100644
--- a/src/eval/dict.rs
+++ b/src/eval/dict.rs
@@ -82,6 +82,12 @@ fn missing_key(key: &Str) -> String {
format!("dictionary does not contain key: {}", key)
}
+impl Debug for Dict {
+ fn fmt(&self, f: &mut Formatter) -> fmt::Result {
+ f.debug_map().entries(self.0.iter()).finish()
+ }
+}
+
impl Display for Dict {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
f.write_char('(')?;
@@ -100,12 +106,6 @@ impl Display for Dict {
}
}
-impl Debug for Dict {
- fn fmt(&self, f: &mut Formatter) -> fmt::Result {
- f.debug_map().entries(self.0.iter()).finish()
- }
-}
-
impl Add for Dict {
type Output = Self;
@@ -124,18 +124,18 @@ impl AddAssign for Dict {
}
}
-impl FromIterator<(Str, Value)> for Dict {
- fn from_iter<T: IntoIterator<Item = (Str, Value)>>(iter: T) -> Self {
- Self(Rc::new(iter.into_iter().collect()))
- }
-}
-
impl Extend<(Str, Value)> for Dict {
fn extend<T: IntoIterator<Item = (Str, Value)>>(&mut self, iter: T) {
Rc::make_mut(&mut self.0).extend(iter);
}
}
+impl FromIterator<(Str, Value)> for Dict {
+ fn from_iter<T: IntoIterator<Item = (Str, Value)>>(iter: T) -> Self {
+ Self(Rc::new(iter.into_iter().collect()))
+ }
+}
+
impl IntoIterator for Dict {
type Item = (Str, Value);
type IntoIter = std::collections::btree_map::IntoIter<Str, Value>;