| Crates.io | duals |
| lib.rs | duals |
| version | 0.0.3 |
| created_at | 2023-05-31 18:29:02.10079+00 |
| updated_at | 2023-06-02 03:01:25.164257+00 |
| description | dual-ownership referance cells |
| homepage | |
| repository | https://github.com/samhdev/duals |
| max_upload_size | |
| id | 879033 |
| size | 8,079 |
DualsDual-Ownership Reference Cells
These are similar to Rc and Arc, but ensure that only two references exist.
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);