Converts a `&[T]` to the limited version without length checking. SAFETY: `slice.len() <= u32::MAX` must hold.
(slice: &'a [T])
| 889 | /// |
| 890 | /// SAFETY: `slice.len() <= u32::MAX` must hold. |
| 891 | pub(super) const unsafe fn from_slice_unchecked(slice: &'a [T]) -> Self { |
| 892 | unsafe { |
| 893 | let len = slice.len(); |
| 894 | let ptr = slice.as_ptr().cast_mut(); |
| 895 | // SAFETY: `&mut [T]` implies that the pointer is non-null. |
| 896 | let raw = SlimRawSlice::from_len_ptr(len, ptr); |
| 897 | // SAFETY: Our length invariant is satisfied by the caller. |
| 898 | let covariant = PhantomData; |
| 899 | Self { raw, covariant } |
| 900 | } |
| 901 | } |
| 902 | } |
| 903 | |
| 904 | impl<T> Deref for SlimSlice<'_, T> { |