1use super::*;
2
3impl From<Array> for Value {
4 fn from(value: Array) -> Self {
5 Self::Array(value.into_inner())
6 }
7}
8
9impl From<Vec<Value>> for Value {
10 fn from(value: Vec<Value>) -> Self {
11 Self::Array(value)
12 }
13}
14
15impl<const N: usize> From<[Value; N]> for Value {
16 fn from(value: [Value; N]) -> Self {
17 Self::Array(value.to_vec())
18 }
19}
20
21impl From<Box<[Value]>> for Value {
22 fn from(value: Box<[Value]>) -> Self {
23 Self::Array(value.to_vec())
24 }
25}
26
27impl TryFrom<Value> for Vec<Value> {
28 type Error = Error;
29 fn try_from(value: Value) -> Result<Self> {
30 value.into_array()
31 }
32}
33
34impl<'a> TryFrom<&'a Value> for &'a [Value] {
35 type Error = Error;
36 fn try_from(value: &'a Value) -> Result<Self> {
37 value.as_array()
38 }
39}
40
41impl<'a> TryFrom<&'a mut Value> for &'a mut Vec<Value> {
42 type Error = Error;
43 fn try_from(value: &'a mut Value) -> Result<Self> {
44 value.as_array_mut()
45 }
46}
47
48impl TryFrom<Value> for Array {
49 type Error = Error;
50 fn try_from(value: Value) -> Result<Self> {
51 value.into_array().map(Array::from)
52 }
53}