[][src]Function bytemuck::allocation::try_cast_vec

pub fn try_cast_vec<A: Pod, B: Pod>(
    input: Vec<A>
) -> Result<Vec<B>, (PodCastError, Vec<A>)>

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 size of the Vec must have the exact same size.
  • In the future this second restriction might be lessened by having the capacity and length get adjusted during transmutation, but for now it's absolute.