Crate pin_arc

Crate pin_arc 

Source
Expand description

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.

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):

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

Structs§

PinRcGeneric
The common implementation shared by PinRc and PinArc.
PinRcGenericStorage
The common implementation shared by PinRcStorage and PinArcStorage.

Type Aliases§

PinArc
PinArcStorage
PinRc
PinRcStorage