Module tagged_ptr

Source
Expand description

This module implements tagged pointers. In order to utilize the pointer packing, you must have a tag type implementing the Tag trait.

We assert that the tag and the reference type is compatible at compile time.

Structs§

TaggedRef
A covariant Copy tagged borrow. This is essentially { pointer: &'a P, tag: T } packed in a single reference.

Traits§

Tag
This describes tags that the TaggedRef struct can hold.

Functions§

bits_for
Returns the number of bits available for use for tags in a pointer to T (this is based on T’s alignment).
bits_for_tags
Returns the correct Tag::BITS constant for a set of tag values.