We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 65d3578 commit 0e0f303Copy full SHA for 0e0f303
1 file changed
src/protocols/ipersistent_list.rs
@@ -0,0 +1,25 @@
1
+use crate::value::{Value,ToValue};
2
+use std::rc::Rc;
3
+use crate::persistent_list_map;
4
+use crate::protocol::ProtocolCastable;
5
+
6
+define_protocol!(IPersistentMap,PersistentListMap);
7
8
+impl persistent_list_map::IPersistentMap for IPersistentMap {
9
+ fn get(&self, key: &Rc<Value>) -> Rc<Value> {
10
+ match &*self.value {
11
+ Value::PersistentListMap(plist_map) => {
12
+ plist_map.get(key)
13
+ },
14
+ _ => panic!("Called Iterable iter on non-iterable"),
15
+ }
16
17
+ fn assoc(&self, key: Rc<Value>, value: Rc<Value>) -> IPersistentMap {
18
19
20
+ plist_map.assoc(key,value).to_rc_value().as_protocol::<IPersistentMap>()
21
22
23
24
25
+}
0 commit comments