duals

Crates.ioduals
lib.rsduals
version0.0.3
sourcesrc
created_at2023-05-31 18:29:02.10079
updated_at2023-06-02 03:01:25.164257
descriptiondual-ownership referance cells
homepage
repositoryhttps://github.com/samhdev/duals
max_upload_size
id879033
size8,079
Sam Huddart (SamHDev)

documentation

https://docs.rs/duals

README

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);
Commit count: 0

cargo fmt