Skip to content

Commit c5e3ba8

Browse files
jturner314bluss
authored andcommitted
Implement From<&'a ArrayBase> for CowArray
1 parent 4a97525 commit c5e3ba8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/impl_cow.rs

+11
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,14 @@ where
7171
Self::from(ArrayView1::from(slice))
7272
}
7373
}
74+
75+
impl<'a, A, S, D> From<&'a ArrayBase<S, D>> for CowArray<'a, A, D>
76+
where
77+
S: Data<Elem = A>,
78+
D: Dimension,
79+
{
80+
/// Create a read-only clone-on-write view of the array.
81+
fn from(array: &'a ArrayBase<S, D>) -> Self {
82+
Self::from(array.view())
83+
}
84+
}

0 commit comments

Comments
 (0)