Skip to main content

Module tagged_ptr

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.

Re-exportsยง

use std::fmt; ๐Ÿ”’
use std::hash::Hash; ๐Ÿ”’
use std::hash::Hash; ๐Ÿ”’
use std::hash::Hasher; ๐Ÿ”’
use std::marker::PhantomData; ๐Ÿ”’
use std::num::NonZero; ๐Ÿ”’
use std::ops::Deref; ๐Ÿ”’
use std::ptr::NonNull; ๐Ÿ”’
use crate::aligned::Aligned; ๐Ÿ”’
use crate::stable_hash::StableHash; ๐Ÿ”’
use crate::stable_hash::StableHashCtxt; ๐Ÿ”’
use crate::stable_hash::StableHasher; ๐Ÿ”’

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.