Struct poison::Poison
[−]
[src]
pub struct Poison<T: ?Sized> { /* fields omitted */ }
A typed poisoning wrapper.
Enforces that access to the contained data respects poisoning.
Methods
impl<T> Poison<T>
[src]
fn new(val: T) -> Self
Create a new Poison in the non-poisoned state.
fn poisoned(val: T) -> Self
Create a new Poison that is already poisoned.
fn into_inner(self) -> LockResult<T>
Extract the data from the Poison.
Returns PoisonError if the Poison is poisoned.
impl<T: ?Sized> Poison<T>
[src]
fn lock(&mut self) -> LockResult<PoisonGuard<T>>
Get a poison lock on this poison.
Returns PoisonError if the Poison is poisoned.
fn heal(&mut self)
Heal the Poison, unpoisoning it if it is poisoned.
fn get(&self) -> LockResult<&T>
Get an immutable reference to the data in this poison.
There is no guard for an immutable reference, since the data must either be immutable or internally poisoned if it has interior mutability.
unsafe fn get_mut(&mut self) -> &mut T
Get a mutable reference without a guard.
Should only be used in combination with PoisonGuard::into_raw.