#smart-pointers #async #signal #shared #memory #future #reaquired

borrow-count

Memory that can be shared with a smart pointer and then reaquired with a future

1 unstable release

new 0.1.0 Feb 16, 2025

#742 in Asynchronous

Download history 83/week @ 2025-02-11

83 downloads per month

MIT license

27KB
611 lines

Borrow Count

Memory that can be shared with a smart pointer and then reaquired with a future.

Example

let unique = Unique::new(0);
let (host, mut share) = unique.share_mut();
tokio::task::spawn(async move {
    tokio::time::sleep(std::time::Duration::from_millis(16)).await;
    *share += 1;
});
let unique = host.await;
assert_eq!(unique.into_inner(), 1)

Dependencies

~0.6–0.8MB
~15K SLoC