Skip to main content

cbor_core/value/
map.rs

1use super::*;
2
3impl From<Map> for Value {
4    fn from(value: Map) -> Self {
5        Self::Map(value.into_inner())
6    }
7}
8
9impl From<BTreeMap<Value, Value>> for Value {
10    fn from(value: BTreeMap<Value, Value>) -> Self {
11        Self::Map(value)
12    }
13}
14
15impl TryFrom<Value> for BTreeMap<Value, Value> {
16    type Error = Error;
17    fn try_from(value: Value) -> Result<Self> {
18        value.into_map()
19    }
20}
21
22impl TryFrom<Value> for Map {
23    type Error = Error;
24    fn try_from(value: Value) -> Result<Self> {
25        value.into_map().map(Map::from)
26    }
27}