Function bytemuck::allocation::try_cast_slice_rc

source ·
pub fn try_cast_slice_rc<A: NoUninit + AnyBitPattern, B: NoUninit + AnyBitPattern>(
    input: Rc<[A]>
) -> Result<Rc<[B]>, (PodCastError, Rc<[A]>)>
Expand description

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

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

The bounds on this function are the same as cast_mut, because a user could call Rc::get_unchecked_mut on the output, which could be observable in the input.

§Failure

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