devela::_dep::bytemuck

Function try_cast_slice_box

pub fn try_cast_slice_box<A, B>(
    input: Box<[A]>,
) -> Result<Box<[B]>, (PodCastError, Box<[A]>)> 
where A: NoUninit, B: AnyBitPattern,
Available on crate feature dep_bytemuck only.
Expand description

Attempts to cast the content type of a Box<[T]>.

On failure you get back an error along with the starting Box<[T]>.

§Failure

  • The start and end content type of the Box<[T]> must have the exact same alignment.
  • The start and end content size in bytes of the Box<[T]> must be the exact same.