Crate ointer

source ·
Expand description

This crate provides a set of traits and macros to enable the creation of custom pointers in Rust, allowing for the storage of extra information in the high bits of a pointer. This extra information can be of various types, and the crate provides utilities for working with these custom pointers efficiently. The crate also offers convenient macros for defining custom ointers and enum ointers and managing them.

Re-exports

Modules

  • This module defines ointers that wraps Box, named BBox(called byte stolen Box) and OBox(called orientable Box, with 1 bit stolen).
  • This module defines ointers that wraps Rc/Weak, named BRc/BWeak(called byte stolen Rc/Weak) and ORc/OWeak(called orientable Rc/Weak, with 1 bit stolen).
  • This module defines ointers that wraps Arc/Weak, named BArc/BWeak(called byte stolen Arc/Weak) and OArc/OWeak(called orientable Arc/Weak, with 1 bit stolen).

Macros

  • Macro used to define custom enum ointers with the same size of usize.
  • Macro used to define Weak like ointers.
  • Macro used to define Box/Rc/Arc like ointers. This crate defines BBox(called byte stolen Box) that wraps Box and steal high 8-bits(1-byte), by using define_ointer_strong!(BBox, Box, 8); And define OBox(called orientable Box) by using define_ointer_strong!(OBox, Box, 1);
  • Macro used to define Rc/Weak or Arc/Weak like shared ointers. This crate defines BRc/BWeak(called byte stolen Rc/Weak) that wraps Rc/Weak and steal high 8-bits(1-byte), by using define_shared_ointer!(BRc, Rc, BWeak, Weak, 8); And define ORc/OWeak(called orientable Rc/Weak) by using define_shared_ointer!(ORc, Rc, OWeak, Weak, 1);

Traits

Type Aliases

  • Type alias for sync::OWeak
  • Type alias for rc::ORc
  • Type alias for rc::OWeak
  • Type alias for sync::OArc
  • Type alias for boxed::OBox