| Crates.io | pointer-value-pair |
| lib.rs | pointer-value-pair |
| version | 0.1.0 |
| created_at | 2022-03-18 21:07:23.544626+00 |
| updated_at | 2022-03-18 21:07:23.544626+00 |
| description | A pair of a pointer and a small integer packed into a pointer-sized object |
| homepage | |
| repository | https://github.com/ennis/pointer-value-pair |
| max_upload_size | |
| id | 552908 |
| size | 9,992 |
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.