bytemuck::allocation

Function try_cast_vec

source
pub fn try_cast_vec<A: NoUninit, B: AnyBitPattern>(
    input: Vec<A>,
) -> Result<Vec<B>, (PodCastError, Vec<A>)>
Expand description

Attempts to cast the content type of a Vec.

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

ยงFailure

  • The start and end content type of the Vec must have the exact same alignment.
  • The start and end content size in bytes of the Vec must be the exact same.
  • The start and end capacity in bytes of the Vec must be the exact same.