Function safe_size_to_count

Source
pub const fn safe_size_to_count<T: Sized>(
    size: usize,
) -> Result<usize, UnalignedSizeError>
Expand description

Checks that the specified size if a multiple of a type’s size and returns the size divided by the type’s size.

§Errors

Returns UnalignedSizeError in case the provided size is not aligned or T is zero sized type.