[−][src]Struct cryo::Cryo
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.
Methods
impl<'a, T: ?Sized + 'a> Cryo<'a, T>
[src]
pub unsafe fn new(x: &'a T) -> Self
[src]
Construct a new Cryo
.
Safety
-
The constructed
Cryo
must not be moved around. This might result in a dangling pointer inCryoRef
. -
The constructed
Cryo
must not be disposed without dropping (e.g., passed tostd::mem::forget
). This might result in a dangling pointer inCryoRef
.
pub fn borrow(&self) -> CryoRef<T>
[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> Debug for Cryo<'a, T>
[src]
impl<'a, T: ?Sized + 'a> Drop for Cryo<'a, T>
[src]
impl<'a, T: ?Sized + Send> Send for Cryo<'a, T>
[src]
impl<'a, T: ?Sized + Send + Sync> Sync for Cryo<'a, T>
[src]
Auto Trait Implementations
impl<'a, T> !RefUnwindSafe for Cryo<'a, T>
impl<'a, T: ?Sized> Unpin for Cryo<'a, T>
impl<'a, T: ?Sized> UnwindSafe for Cryo<'a, T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,