Function safe_transmute::align::check_alignment

source ·
pub fn check_alignment<S, T>(data: &[S]) -> Result<(), UnalignedError<'_, S, T>>
Expand description

Check whether the given data slice of Ss is properly aligned for reading and writing as a slice of Ts.

§Errors

An Error::Unaligned error is returned with the number of bytes to discard from the front in order to make the conversion safe from alignment concerns.