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]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

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

fn drop(&mut self)[src]

Executes the destructor for this type. Read more

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]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.