#memory-access #drop #by-value

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

#21 in #memory-access

Download history 235/week @ 2024-08-05 5/week @ 2024-08-12 109/week @ 2024-09-09

109 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