Function bytemuck::allocation::try_cast_box

source ·
pub fn try_cast_box<A: NoUninit, B: AnyBitPattern>(
    input: Box<A>
) -> Result<Box<B>, (PodCastError, Box<A>)>
Expand description

Attempts to cast the content type of a Box.

On failure you get back an error along with the starting Box.

§Failure

  • The start and end content type of the Box must have the exact same alignment.
  • The start and end size of the Box must have the exact same size.