impl TryFrom<&[T]> for Simd
This commit is contained in:
parent
ecc28752e8
commit
7ac1fbbcb1
1 changed files with 24 additions and 0 deletions
|
|
@ -650,6 +650,30 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
impl<T, const LANES: usize> TryFrom<&[T]> for Simd<T, LANES>
|
||||
where
|
||||
LaneCount<LANES>: SupportedLaneCount,
|
||||
T: SimdElement,
|
||||
{
|
||||
type Error = core::array::TryFromSliceError;
|
||||
|
||||
fn try_from(slice: &[T]) -> Result<Self, Self::Error> {
|
||||
Ok(Self::from_array(slice.try_into()?))
|
||||
}
|
||||
}
|
||||
|
||||
impl<T, const LANES: usize> TryFrom<&mut [T]> for Simd<T, LANES>
|
||||
where
|
||||
LaneCount<LANES>: SupportedLaneCount,
|
||||
T: SimdElement,
|
||||
{
|
||||
type Error = core::array::TryFromSliceError;
|
||||
|
||||
fn try_from(slice: &mut [T]) -> Result<Self, Self::Error> {
|
||||
Ok(Self::from_array(slice.try_into()?))
|
||||
}
|
||||
}
|
||||
|
||||
mod sealed {
|
||||
pub trait Sealed {}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue