From be5f60348679b9e1f64a5f1ff237b92f911a37f2 Mon Sep 17 00:00:00 2001 From: Jim Turner Date: Sun, 30 May 2021 00:36:44 -0400 Subject: [PATCH] Add From> for 1-D owned arrays --- src/arraytraits.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/arraytraits.rs b/src/arraytraits.rs index 421fc4713..db0c0892e 100644 --- a/src/arraytraits.rs +++ b/src/arraytraits.rs @@ -148,6 +148,18 @@ where { } +impl From> for ArrayBase +where + S: DataOwned, +{ + /// Create a one-dimensional array from a boxed slice (no copying needed). + /// + /// **Panics** if the length is greater than `isize::MAX`. + fn from(b: Box<[A]>) -> Self { + Self::from_vec(b.into_vec()) + } +} + impl From> for ArrayBase where S: DataOwned,