Struct cryo::CryoMut

source ·
pub struct CryoMut<'a, T: ?Sized + 'a> { /* private fields */ }
Expand description

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 will be blocked until all references to the contained value are dropped. This ensures that none of the references can outlive the referent.

See the module-level documentation for more details.

Implementations

Construct a new CryoMut.

Safety
  • The constructed CryoMut must not be moved around. This might result in a dangling pointer in CryoMut*Guard.

  • The constructed CryoMut must not be disposed without dropping (e.g., passed to std::mem::forget). This might result in a dangling pointer in CryoMut*Guard.

Acquire a read (shared) lock on a CryoMut.

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

Acquire a write (exclusive) lock on a CryoMut.

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

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

Formats the value using the given formatter. Read more
Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.