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<'a> TryFrom<&'a Value> for &'a BTreeMap<Value, Value> {
23 type Error = Error;
24 fn try_from(value: &'a Value) -> Result<Self> {
25 value.as_map()
26 }
27}
28
29impl<'a> TryFrom<&'a mut Value> for &'a mut BTreeMap<Value, Value> {
30 type Error = Error;
31 fn try_from(value: &'a mut Value) -> Result<Self> {
32 value.as_map_mut()
33 }
34}
35
36impl TryFrom<Value> for Map {
37 type Error = Error;
38 fn try_from(value: Value) -> Result<Self> {
39 value.into_map().map(Map::from)
40 }
41}