Skip to content

Commit

Permalink
Implement From<[T; N]> for Value
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Nov 17, 2024
1 parent 2ccb5b6 commit 4e5f985
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/value/from.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,12 @@ impl<T: Into<Value>> From<Vec<T>> for Value {
}
}

impl<T: Into<Value>, const N: usize> From<[T; N]> for Value {
fn from(array: [T; N]) -> Self {
Value::Array(array.into_iter().map(Into::into).collect())
}
}

impl<T: Clone + Into<Value>> From<&[T]> for Value {
/// Convert a slice to `Value::Array`.
///
Expand Down

0 comments on commit 4e5f985

Please sign in to comment.