This crate provides the PointerAndValue
type, a wrapper over a raw *const T
pointer that also packs a small integer value
in the alignment bits, with the guarantee that mem::size_of::<PointerAndValue<T>>() == mem::size_of::<*const T>()
.
It is inspired by llvm::PointerIntPair from LLVM, and TfPointerAndBits from USD.
It also provides Cow
, which is similar to std::borrow::Cow but stores either &'a T
or Box<T>
, and is guaranteed to be the same size as *const T
.
mem::align_of
returns a minimum alignment of 1.