duals 0.0.3

dual-ownership referance cells
Documentation
  • Coverage
  • 100%
    3 out of 3 items documented2 out of 2 items with examples
  • Size
  • Source code size: 7.76 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.66 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 13s Average build duration of successful builds.
  • all releases: 13s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • SamHDev

Duals

Dual-Ownership Reference Cells

These are similar to Rc and Arc, but ensure that only two references exist.

Example

use duals::Dual;

// create a new `Dual`
let (left, right) = Dual::new(10);

// use both
println!("{:?} {:?}", *left, *right);

// drop one reference
drop(left);

// we can still use the other
println!("{:?}", *right);

// drop the other reference; value is dropped
drop(right);