#memory-access #drop #read #read-write #by-value #owner #reading

guest

By-value memory storage without by-value memory access

3 unstable releases

0.2.0 Sep 9, 2024
0.1.1 Aug 7, 2024
0.1.0 Aug 6, 2024

#6 in #owner

26 downloads per month

MIT license

4KB
57 lines

Guest

By-value memory storage without by-value memory access.

Usage

Guests allow one to have reading and writing access whilst garunteeing that the memory is handed on to the next owner after usage.

Some example types are as follows:

  • Read access: Arc<Guest<T>>
  • Write access: Arc<Mutex<Guest<T>>>
  • Read and Write access: Arc<RwLock<Guest<T>>>

Some example callbacks could be:

  • Just dropping: std::mem::drop
  • Sending through a channel: move |last| sender.send(last).unwrap()
  • Setting a value: |last| capture = last

Dependencies

~0.6–0.8MB
~15K SLoC