Struct cryo::Cryo[][src]

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

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’s execution will be prevented from moving forward (at least) until all references to the expiring Cryo 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> Cryo<'a, T, Lock>[src]

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

Construct a new Cryo.

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

Borrow a cell using runtime lifetime rules.

pub fn get(&self) -> &'a T[src]

Borrow a cell using compile-time lifetime rules.

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

Trait Implementations

impl<'a, T: ?Sized + Debug, Lock: Lock> Debug for Cryo<'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 Cryo<'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 Cryo<'a, T, Lock> where
    Lock::LockMarker: Send
[src]

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

Auto Trait Implementations

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

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

impl<'a, T: ?Sized, Lock> UnwindSafe for Cryo<'a, T, Lock> where
    Lock: UnwindSafe,
    T: RefUnwindSafe

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.