pub struct Ref<'a, V>where
V: 'a,{ /* private fields */ }Expand description
Reference to a value.
Implementations§
Source§impl<'a, V> Ref<'a, V>
impl<'a, V> Ref<'a, V>
Sourcepub fn try_clone(&self) -> Result<Ref<'a, V>, RefOverflow>
pub fn try_clone(&self) -> Result<Ref<'a, V>, 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
Refs with an ever-increasing reference count are not supported by this library.Reaching
isize::MAXmay be possible withstd::mem::forget(Ref::clone(&r)).
Trait Implementations§
Source§impl<'a, V> Clone for Ref<'a, V>
impl<'a, V> Clone for Ref<'a, V>
Source§fn clone(&self) -> Ref<'a, V>
fn clone(&self) -> Ref<'a, V>
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
Refs with an ever-increasing reference count are not supported by this library.Reaching
isize::MAXmay be possible withstd::mem::forget(Ref::clone(&r)).
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more