Skip to content

Commit 2b65ca0

Browse files
authored
Merge pull request #1215 from dtolnay/fromarray
Implement From<[T; N]> for Value
2 parents 2ccb5b6 + 4e5f985 commit 2b65ca0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/value/from.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,12 @@ impl<T: Into<Value>> From<Vec<T>> for Value {
183183
}
184184
}
185185

186+
impl<T: Into<Value>, const N: usize> From<[T; N]> for Value {
187+
fn from(array: [T; N]) -> Self {
188+
Value::Array(array.into_iter().map(Into::into).collect())
189+
}
190+
}
191+
186192
impl<T: Clone + Into<Value>> From<&[T]> for Value {
187193
/// Convert a slice to `Value::Array`.
188194
///

0 commit comments

Comments
 (0)