Crate inscope

Source
Expand description

§inscope

This crate provides a smart pointer that allows dropping a value while it is still borrowed. In most cases, this is completely useless. However, it can be useful when a resource is deleted but still needs to be used while other threads process the deletion.

Deleting a value while it is still borrowed is an unsafe operation. You will need to use unsafe blocks to use this crate effectively.

§Example

use inscope::Scope;
 
let scope = Scope::new(42);
assert_eq!(*scope, Some(42));
 
unsafe {
   scope.delete();
}
 
assert_eq!(*scope, None);

Structs§

Scope
A smart pointer that can drop its content while borrowed.