impl TryFrom<&[T]> for Simd
This commit is contained in:
parent
ecc28752e8
commit
7ac1fbbcb1
@ -650,6 +650,30 @@ fn from(vector: Simd<T, LANES>) -> Self {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 {
|
mod sealed {
|
||||||
pub trait Sealed {}
|
pub trait Sealed {}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user