Skip to main content

cbor_core/value/
index.rs

1use super::*;
2
3impl<I: Into<Value>> Index<I> for Value {
4    type Output = Value;
5
6    fn index(&self, index: I) -> &Value {
7        self.get(index)
8            .expect("value should be an array or map containing the given key")
9    }
10}
11
12impl<I: Into<Value>> IndexMut<I> for Value {
13    fn index_mut(&mut self, index: I) -> &mut Value {
14        self.get_mut(index)
15            .expect("value should be an array or map containing the given key")
16    }
17}