Add trait for single unlocking of an item
Add a trait serving a lock which features only an irreversible unlocking of an item. Such a type may be used to pass around locked items while permitting the user to unlock them and perform any operation with a copy of the original item.
This commit is contained in:
parent
33f097d662
commit
6c2962efe9
1 changed files with 5 additions and 0 deletions
5
libimagstore/src/single_use_lock.rs
Normal file
5
libimagstore/src/single_use_lock.rs
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
pub trait SingleUseLock<T> {
|
||||||
|
fn access(&self) -> &T;
|
||||||
|
fn unlock(self) -> T;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue