pub struct Ref<'a, V> where
V: 'a, { /* private fields */ }
Expand description
Reference to a value.
Implementations
sourceimpl<'a, V> Ref<'a, V>
impl<'a, V> Ref<'a, V>
sourcepub fn try_clone(&self) -> Result<Self, RefOverflow>
pub fn try_clone(&self) -> Result<Self, RefOverflow>
Returns a clone of this Ref
.
This method allows handling of reference overflows, but:
-
Having 2 billion (32-bit system) / 9 quintillion (64-bit system) references to an object is not a realistic scenario in most applications.
-
Applications that hold
Ref
s with an ever-increasing reference count are not supported by this library.Reaching
isize::MAX
may be possible withstd::mem::forget(Ref::clone(&r))
.
Trait Implementations
sourceimpl<'a, V> Clone for Ref<'a, V>
impl<'a, V> Clone for Ref<'a, V>
sourcefn clone(&self) -> Self
fn clone(&self) -> Self
Returns a clone of this Ref
.
Panics
Panics if the number of references is isize::MAX
:
-
Having 2 billion / 9 quintillion references to an object is not a realistic scenario in most applications.
-
Applications that hold
Ref
s with an ever-increasing reference count are not supported by this library.Reaching
isize::MAX
may be possible withstd::mem::forget(Ref::clone(&r))
.
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl<'a, V> RefUnwindSafe for Ref<'a, V> where
V: RefUnwindSafe,
impl<'a, V> Send for Ref<'a, V> where
V: Sync,
impl<'a, V> Sync for Ref<'a, V> where
V: Sync,
impl<'a, V> Unpin for Ref<'a, V>
impl<'a, V> UnwindSafe for Ref<'a, V> where
V: RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more