From 4e5f985958bedbc7e75ba6c1931edaf73508c4a7 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 16 Nov 2024 17:17:56 -0800 Subject: [PATCH] Implement From<[T; N]> for Value --- src/value/from.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/value/from.rs b/src/value/from.rs index 2dae925a1..df4b2038c 100644 --- a/src/value/from.rs +++ b/src/value/from.rs @@ -183,6 +183,12 @@ impl> From> for Value { } } +impl, const N: usize> From<[T; N]> for Value { + fn from(array: [T; N]) -> Self { + Value::Array(array.into_iter().map(Into::into).collect()) + } +} + impl> From<&[T]> for Value { /// Convert a slice to `Value::Array`. ///