From ceed9e52bde204c4666cb4c3f429c49861d9b7a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Crozet?= Date: Thu, 24 Mar 2016 19:03:48 +0100 Subject: [PATCH] Implement `Arbitrary` for `VecN`. --- src/structs/vecn.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/structs/vecn.rs b/src/structs/vecn.rs index ecf41461..05689a79 100644 --- a/src/structs/vecn.rs +++ b/src/structs/vecn.rs @@ -19,6 +19,9 @@ pub struct VecN> { pub at: GenericArray } +unsafe impl> Send for VecN { +} + impl> Clone for VecN { fn clone(&self) -> VecN { VecN::new(self.at.clone()) @@ -109,4 +112,12 @@ impl> Zero for VecN { } } +#[cfg(feature="arbitrary")] +impl> Arbitrary for VecN { + #[inline] + fn arbitrary(g: &mut G) -> VecN { + (0 .. D::to_usize()).map(|_| Arbitrary::arbitrary(g)).collect() + } +} + vecn_dvec_common_impl!(VecN, D);