Struct cryo::Cryo

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

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

Cryo is a variation of CryoMut that only can be immutably borrowed.

When a Cryo 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 Cryo.

Safety
  • The constructed Cryo must not be moved around. This might result in a dangling pointer in CryoRef.

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

Borrow a cell using runtime lifetime rules.

Borrow a cell using compile-time lifetime rules.

This operation is no-op since Cryo only can be immutably borrowed.

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.