ndarray
ndarray copied to clipboard
Add From impls for CowArray, similar to Array and ArrayView
Discussed in https://github.com/rust-ndarray/ndarray/discussions/1036
Originally posted by hombit June 18, 2021
Is there any reason why CowArray doesn't implement all From which is implemented by both Array and ArrayView? My current usage is limited to build CowArray from both &Vec and Vec, but generally I'd like to write something like:
struct S<'a> {
ca: CowArray<'a, f64, Ix1>
}
impl<'a> S<'a> {
fn new(a: impl Into<CowArray<'a, f64, Ix1>>) -> Self {
Self {ca: a.into()}
}
}
Two PRs will resolve this:
- Conversions from owned types: #1028
- Conversions from slices/references: #1038