Expand description
§viaptr
An experimental library for packing complex types into pointer-sized fields.
§Examples
ⓘ
Compact<Result<Box<A>, Box<B>>> // A pointer to A or B, taking up only one machine word
Compact<(Box<A>, Bits<2>)> // A tagged pointer with two additional bits of information
§TODO
- document safety constraints on unsafe traits and functions
- general documentation
§License
Mozilla Public License 2.0
Modules§
Structs§
- Bits
- Unsigned integers at most
N
bits long. - Fits
InUsize - A predicate checking if
usize
has at leastN
bits. - Free
Bits - A predicate checking if
P
is aligned enough to fitN
bits. - Maybe
Owned - A wrapper type to construct values which might not own their contents.
- Nest
Option - Like
Option
, but preservesPointer
implementation when nested. - Null
- A value always encoded as a null pointer.
Traits§
- Aligned
To - Require minimum
Pointer
alignment. - Clone
InPlace - A trait for types which can be cloned in place.
- Eval
- Predicate evaluation trait.
- NonNull
- Require non-null pointers from
Pointer::into_ptr
. - Pointer
- Conversion to and from
*const ()
. - Verify
Alignment - Verify
Pointer
alignment validity and magnitude.