2 releases

0.0.3 Jun 2, 2023
0.0.2 Jun 2, 2023
0.0.1 May 31, 2023

#14 in #dual

GPL-3.0-or-later

8KB
111 lines

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

lib.rs:

Dual-Ownership Reference Cells

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

  • Rc is similar to Dual
  • Arc is similar to ADual

See the struct's documentation for more details.

This Library uses UNSAFE! Use at your own RISK!

No runtime deps