diff --git a/serialization-tests/tests/serialize.rs b/serialization-tests/tests/serialize.rs index 953f2a434..efb3bacd9 100644 --- a/serialization-tests/tests/serialize.rs +++ b/serialization-tests/tests/serialize.rs @@ -9,7 +9,7 @@ extern crate rmp_serde; #[cfg(feature = "ron")] extern crate ron; -use ndarray::{arr0, arr1, arr2, s, ArcArray, ArrayD, Ix2, IxDyn}; +use ndarray::{arr0, arr1, arr2, s, ArcArray, ArcArray2, ArrayD, IxDyn}; #[test] fn serial_many_dim_serde() { @@ -98,13 +98,13 @@ fn serial_ixdyn_serde() { fn serial_wrong_count_serde() { // one element too few let text = r##"{"v":1,"dim":[2,3],"data":[3,1,2.2,3.1,4]}"##; - let arr = serde_json::from_str::>(text); + let arr = serde_json::from_str::>(text); println!("{:?}", arr); assert!(arr.is_err()); // future version let text = r##"{"v":200,"dim":[2,3],"data":[3,1,2.2,3.1,4,7]}"##; - let arr = serde_json::from_str::>(text); + let arr = serde_json::from_str::>(text); println!("{:?}", arr); assert!(arr.is_err()); } diff --git a/src/aliases.rs b/src/aliases.rs index 1c82120a4..f7c71b3d4 100644 --- a/src/aliases.rs +++ b/src/aliases.rs @@ -3,7 +3,7 @@ use crate::dimension::Dim; #[allow(deprecated)] -use crate::{Array, ArrayView, ArrayViewMut, Ix, IxDynImpl, RcArray}; +use crate::{ArcArray, Array, ArrayView, ArrayViewMut, Ix, IxDynImpl, RcArray}; /// Create a zero-dimensional index #[allow(non_snake_case)] @@ -158,3 +158,8 @@ pub type RcArray1 = RcArray; #[allow(deprecated)] #[deprecated(note = "`RcArray` has been renamed to `ArcArray`")] pub type RcArray2 = RcArray; + +/// one-dimensional shared ownership array +pub type ArcArray1 = ArcArray; +/// two-dimensional shared ownership array +pub type ArcArray2 = ArcArray; diff --git a/src/free_functions.rs b/src/free_functions.rs index 7e2bb752f..8319865dd 100644 --- a/src/free_functions.rs +++ b/src/free_functions.rs @@ -9,8 +9,8 @@ use std::mem::{forget, size_of}; use std::slice; -use crate::dimension; use crate::imp_prelude::*; +use crate::{dimension, ArcArray1, ArcArray2}; /// Create an [**`Array`**](type.Array.html) with one, two or /// three dimensions. @@ -63,7 +63,7 @@ pub fn arr1(xs: &[A]) -> Array1 { } /// Create a one-dimensional array with elements from `xs`. -pub fn rcarr1(xs: &[A]) -> ArcArray { +pub fn rcarr1(xs: &[A]) -> ArcArray1 { arr1(xs).into_shared() } @@ -289,7 +289,7 @@ where /// Create a two-dimensional array with elements from `xs`. /// -pub fn rcarr2>(xs: &[V]) -> ArcArray { +pub fn rcarr2>(xs: &[V]) -> ArcArray2 { arr2(xs).into_shared() }