[−][src]Function maligned::aligned
pub fn aligned<A: Alignment, T>(t: T) -> Aligned<A, T>
Convenience function for creating a new Aligned
Because of the current interaction between generics and impl arguments
the function requires both types to be given, though the second one can
be given the default _
To align a byte array to a 256 bit boundary
let a = aligned::<Bit256, _>([0_u8; 1024]); assert_eq!(&a[0] as *const u8 as usize % std::mem::align_of::<Bit256>(), 0);