#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

Download history 237/week @ 2024-08-06 3/week @ 2024-08-13 57/week @ 2024-09-03 76/week @ 2024-09-10 21/week @ 2024-09-17 17/week @ 2024-09-24 9/week @ 2024-10-01

145 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

~1MB
~15K SLoC