constptr 0.3.1

NonNull without mutability
Documentation
  • Coverage
  • 100%
    9 out of 9 items documented6 out of 8 items with examples
  • Size
  • Source code size: 19.07 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.8 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 11s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • cehteh

ConstPtr

Rusts std::ptr::NonNull is a mutable pointer. Sometimes this has implications that are not desired. ConstPtr wraps NullPtr but removes the mutable and uninit API's. As consequence it can only be constructed to point to a valid object (although it may become dangling when the object becomes destroyed). This simplifies handling lifetime erased references because a &reference implicitly coerces to a *const pointer and adds some safety net as in one can't accidentally get a mutable reference to something that should be const.

no_std compatibility

By default the 'std' feature is enabled which pulls in dependencies on rusts stdlib. When one disables this in 'default' then ConstPtr becomes no-std compatible.