[−][src]Struct crndm::cell::Ref
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 Ref
s 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]
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]
A: LooseTxInUnsafe,
T: LooseTxInUnsafe,
impl<'b, T: ?Sized, A> RefUnwindSafe for Ref<'b, T, A> where
T: RefUnwindSafe,
[src]
T: RefUnwindSafe,
impl<'b, T: ?Sized, A> TxInSafe for Ref<'b, T, A> where
T: TxInSafe,
[src]
T: TxInSafe,
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]
T: RefUnwindSafe,
impl<'b, T: ?Sized, A> VSafe for Ref<'b, T, A> where
A: VSafe,
T: VSafe,
[src]
A: VSafe,
T: VSafe,
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,
pub 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> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, A> ToString<A> for T where
A: MemPool,
T: Display + ?Sized,
[src]
A: MemPool,
T: Display + ?Sized,
pub default fn to_pstring(&Self, &Journal<A>) -> String<A>
[src]
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.
pub 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>,
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]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,