diff --git a/utils/src/memory.rs b/utils/src/memory.rs index 5440d1e87..e0b80325a 100644 --- a/utils/src/memory.rs +++ b/utils/src/memory.rs @@ -73,12 +73,3 @@ pub fn to_byte_array(o: T) -> [u8; S] { assert_eq!(S, size_of::()); unsafe { *(&o as *const T).cast() } } - -/// Get a byte array as a flat object. -/// -/// WARNING: while this is technically safe, care must be taken if the object requires aligned access. -#[inline(always)] -pub fn as_flat_object(b: &[u8; S]) -> &T { - assert!(std::mem::size_of::() <= S); - unsafe { &*b.as_ptr().cast() } -}