Function bytemuck::allocation::try_cast_arc

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

Attempts to cast the content type of a Arc.

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

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 Arc must have the exact same alignment.
  • The start and end size of the Arc must have the exact same size.