Struct cryo::CryoMut[][src]

pub struct CryoMut<'a, T: ?Sized, Lock: Lock> { /* fields omitted */ }

A cell-like type that enforces the lifetime restriction of its borrowed value at runtime.

CryoMut is a variation of Cryo that can be mutably borrowed.

When a CryoMut is dropped, the current thread’s execution will be prevented from moving forward (at least) until all references to the expiring CryoMut are dropped. This ensures that none of the outstanding references can outlive the referent.

See the module-level documentation for more details.

Implementations

impl<'a, T: ?Sized + 'a, Lock: Lock> CryoMut<'a, T, Lock>[src]

pub fn new(x: &'a mut T) -> Self[src]

Construct a new CryoMut.

pub fn read(self: Pin<&Self>) -> CryoMutReadGuard<T, Lock>[src]

Acquire a read (shared) lock on a CryoMut.

pub fn try_read(self: Pin<&Self>) -> Option<CryoMutReadGuard<T, Lock>>[src]

Attempt to acquire a read (shared) lock on a CryoMut.

pub fn write(self: Pin<&Self>) -> CryoMutWriteGuard<T, Lock>[src]

Acquire a write (exclusive) lock on a CryoMut.

pub fn try_write(self: Pin<&Self>) -> Option<CryoMutWriteGuard<T, Lock>>[src]

Attempt to acquire a write (exclusive) lock on a CryoMut.

pub fn try_get_mut<'this>(self: Pin<&'this mut Self>) -> Option<&'this mut T>[src]

Attempt to mutably borrow a CryoMut using compile-time lifetime rules.

Returns None if the CryoMut is already borrowed via CryoMutReadGuard or CryoMutWriteGuard.

Trait Implementations

impl<'a, T: ?Sized + Debug, Lock: Lock> Debug for CryoMut<'a, T, Lock>[src]

impl<'a, T: ?Sized + 'a, Lock: Lock> Drop for CryoMut<'a, T, Lock>[src]

impl<'a, T: ?Sized + Send, Lock: Lock> Send for CryoMut<'a, T, Lock> where
    Lock::LockMarker: Send
[src]

impl<'a, T: ?Sized + Send + Sync, Lock: Lock> Sync for CryoMut<'a, T, Lock> where
    Lock::LockMarker: Send
[src]

Auto Trait Implementations

impl<'a, T, Lock> !RefUnwindSafe for CryoMut<'a, T, Lock>

impl<'a, T, Lock> !Unpin for CryoMut<'a, T, Lock>

impl<'a, T, Lock> !UnwindSafe for CryoMut<'a, T, Lock>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.