pin-arc 0.2.1

Reference counting pointers without allocation using pinning
Documentation
  • Coverage
  • 66.67%
    8 out of 12 items documented2 out of 2 items with examples
  • Size
  • Source code size: 11.69 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.18 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 12s Average build duration of successful builds.
  • all releases: 12s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • m-mueller678/pin-rc
    1 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • m-mueller678

This crate provides reference counting pointers similar to Rc and Arc, but without heap allocation. You are responsible for creating a Pin{Arc|Rc}Storage, which you can obtain Pin{Arc|Rc} pointers from. The storage needs to be pinned, for example using pin.

# use std::pin::pin;
# use pin_arc::{PinArc, PinArcStorage};
let storage = pin!(PinArcStorage::new(4));
let arc = storage.as_ref().create_handle();
println!("{arc:?}");

If the storage is dropped before all references to it are released, the program is aborted (even if you have set panics to unwind):

# use std::pin::pin;
# use pin_arc::{PinArc,PinArcStorage};
fn escaping_handle() -> PinArc<u32> {
    let storage = pin!(PinArcStorage::new(4));
    storage.as_ref().create_handle()
}
escaping_handle();