1use super::*;
2
3impl<'a> From<Map<'a>> for Value<'a> {
4 fn from(value: Map<'a>) -> Self {
5 Self::Map(value.into_inner())
6 }
7}
8
9impl<'a> From<BTreeMap<Value<'a>, Value<'a>>> for Value<'a> {
10 fn from(value: BTreeMap<Value<'a>, Value<'a>>) -> Self {
11 Self::Map(value)
12 }
13}
14
15impl<'a> TryFrom<Value<'a>> for BTreeMap<Value<'a>, Value<'a>> {
16 type Error = Error;
17 fn try_from(value: Value<'a>) -> Result<Self> {
18 value.into_map()
19 }
20}
21
22impl<'a> TryFrom<&'a Value<'a>> for &'a BTreeMap<Value<'a>, Value<'a>> {
23 type Error = Error;
24 fn try_from(value: &'a Value<'a>) -> Result<Self> {
25 value.as_map()
26 }
27}
28
29impl<'a> TryFrom<&'a mut Value<'a>> for &'a mut BTreeMap<Value<'a>, Value<'a>> {
30 type Error = Error;
31 fn try_from(value: &'a mut Value<'a>) -> Result<Self> {
32 value.as_map_mut()
33 }
34}
35
36impl<'a> TryFrom<Value<'a>> for Map<'a> {
37 type Error = Error;
38 fn try_from(value: Value<'a>) -> Result<Self> {
39 value.into_map().map(Map::from)
40 }
41}