[][src]Struct crndm::cell::Ref

pub struct Ref<'b, T: 'b + PSafe + ?Sized, A: MemPool> { /* fields omitted */ }

Implementations

impl<'b, T: PSafe + ?Sized, A: MemPool> Ref<'b, T, A>[src]

pub fn clone(orig: &Ref<'b, T, A>) -> Ref<'b, T, A>[src]

Copies a Ref.

The LogRefCell is already immutably borrowed, so this cannot fail. To be able to borrow mutably, all Refs should go out of scope.

This is an associated function that needs to be used as Ref::clone(...). A Clone implementation or a method would interfere with the widespread use of r.borrow().clone() to clone the contents of a LogRefCell.

pub fn leak(orig: Ref<'b, T, A>) -> &'b T[src]

Convert into a reference to the underlying data.

The underlying RefCell can never be mutably borrowed from again and will always appear already immutably borrowed. It is not a good idea to leak more than a constant number of references. The RefCell can be immutably borrowed again if only a smaller number of leaks have occurred in total.

This is an associated function that needs to be used as Ref::leak(...). A method would interfere with methods of the same name on the contents of a RefCell used through Deref.

Examples

#![feature(cell_leak)]
use std::cell::{RefCell, Ref};
let cell = RefCell::new(0);

let value = Ref::leak(cell.borrow());
assert_eq!(*value, 0);

assert!(cell.try_borrow().is_ok());
assert!(cell.try_borrow_mut().is_err());

Trait Implementations

impl<T: PSafe + ?Sized, A: MemPool, '_> Deref for Ref<'_, T, A>[src]

type Target = T

The resulting type after dereferencing.

impl<T: Display + PSafe, A: MemPool, '_> Display for Ref<'_, T, A>[src]

impl<T: PSafe + ?Sized, A: MemPool, '_> Drop for Ref<'_, T, A>[src]

impl<T: PSafe + PClone<A>, A: MemPool, '_> PFrom<Ref<'_, T, A>, A> for LogRefCell<T, A>[src]

pub fn pfrom(other: Ref<'_, T, A>, j: &Journal<A>) -> Self[src]

Crates a new LogRefCell and drops the Ref

After calling this function, the Ref won't be available anymore. It will be possible to borrow the LogRefCell mutably. The new LogRefCell has a new location with the same data.

impl<T: PSafe + ?Sized, A: MemPool, '_> PSafe for Ref<'_, T, A>[src]

impl<T: ?Sized, A: MemPool, '_> !Send for Ref<'_, T, A>[src]

impl<T: ?Sized, A: MemPool, '_> !Sync for Ref<'_, T, A>[src]

impl<T: ?Sized, A: MemPool, '_> !TxOutSafe for Ref<'_, T, A>[src]

Auto Trait Implementations

impl<'b, T: ?Sized, A> LooseTxInUnsafe for Ref<'b, T, A> where
    A: LooseTxInUnsafe,
    T: LooseTxInUnsafe
[src]

impl<'b, T: ?Sized, A> RefUnwindSafe for Ref<'b, T, A> where
    T: RefUnwindSafe
[src]

impl<'b, T: ?Sized, A> TxInSafe for Ref<'b, T, A> where
    T: TxInSafe
[src]

impl<'b, T: ?Sized, A> Unpin for Ref<'b, T, A>[src]

impl<'b, T: ?Sized, A> UnwindSafe for Ref<'b, T, A> where
    T: RefUnwindSafe
[src]

impl<'b, T: ?Sized, A> VSafe for Ref<'b, T, A> where
    A: VSafe,
    T: VSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

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

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

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

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

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, A> ToString<A> for T where
    A: MemPool,
    T: Display + ?Sized
[src]

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.

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,