pub struct Rc<C, V, S>where
C: Counter,{ /* private fields */ }
Expand description
Reference counted thin pointer, that can hold one sized value and one (dynamically sized) slice
Implementations§
Source§impl<C, V> Rc<C, V, ()>where
C: Counter,
impl<C, V> Rc<C, V, ()>where
C: Counter,
Sourcepub fn from_value(value: V) -> Self
pub fn from_value(value: V) -> Self
Creates a reference counter from a (sized) value, storing it in the value
field
Source§impl<C, S> Rc<C, (), S>where
C: Counter,
impl<C, S> Rc<C, (), S>where
C: Counter,
Sourcepub fn from_array_into_slice<const N: usize>(array: [S; N]) -> Self
pub fn from_array_into_slice<const N: usize>(array: [S; N]) -> Self
Creates a reference counter from an array, storing it in the slice
field
and erasing the array length from the type
If you want to keep the const length of the array, you should use
from_value
instead. The memory usage of the RC
allocation actually does not differ between these two.
Source§impl<C, S> Rc<C, (), S>
impl<C, S> Rc<C, (), S>
Sourcepub fn from_slice_clone(slice: &[S]) -> Self
pub fn from_slice_clone(slice: &[S]) -> Self
Creates a reference counter from a slice, cloning all elements into the
slice
field
If your slice contains elements that implement copy, you should use
from_slice_copy
instead, which can be more
efficient. (Rust, specialisation when?)
Source§impl<C, S> Rc<C, (), S>
impl<C, S> Rc<C, (), S>
Sourcepub fn from_slice_copy(slice: &[S]) -> Self
pub fn from_slice_copy(slice: &[S]) -> Self
Creates a reference counter from a slice, copying all elements into
the slice
field
Source§impl<C, V, S> Rc<C, V, S>where
C: Counter,
impl<C, V, S> Rc<C, V, S>where
C: Counter,
Sourcepub fn from_value_and_array_into_slice<const N: usize>(
value: V,
array: [S; N],
) -> Self
pub fn from_value_and_array_into_slice<const N: usize>( value: V, array: [S; N], ) -> Self
Creates a reference counter from a value and an array, with the array
being stored in the slice
field
Source§impl<C, V, S> Rc<C, V, S>
impl<C, V, S> Rc<C, V, S>
Sourcepub fn from_value_and_slice_clone(value: V, slice: &[S]) -> Self
pub fn from_value_and_slice_clone(value: V, slice: &[S]) -> Self
Creates a reference counter from a value and a slice, cloning all
elements of the slice into the slice
field
If your slice contains elements that implement copy, you should use
from_value_and_slice_copy
instead,
which can be more efficient. (Rust, specialisation when?)
Source§impl<C, V, S> Rc<C, V, S>
impl<C, V, S> Rc<C, V, S>
Sourcepub fn from_value_and_slice_copy(value: V, slice: &[S]) -> Self
pub fn from_value_and_slice_copy(value: V, slice: &[S]) -> Self
Creates a reference counter from a value and a slice, copying all
elements of the slice into the slice
field
Source§impl<C, V, S> Rc<C, V, S>where
C: Counter,
impl<C, V, S> Rc<C, V, S>where
C: Counter,
Sourcepub fn as_value_ref(&self) -> &V
pub fn as_value_ref(&self) -> &V
Gets an immurable reference to the value stored in the value
field
Sourcepub fn as_slice_ref(&self) -> &[S]
pub fn as_slice_ref(&self) -> &[S]
Gets an immurable reference to the slice stored in the slice
field
Sourcepub fn strong_count(&self) -> usize
pub fn strong_count(&self) -> usize
Gets the strong pointer count
Sourcepub fn weak_count(&self) -> usize
pub fn weak_count(&self) -> usize
Gets the weak pointer count
Trait Implementations§
impl<C, V, S> Send for Rc<C, V, S>
impl<C, V, S> Sync for Rc<C, V, S>
Auto Trait Implementations§
impl<C, V, S> Freeze for Rc<C, V, S>
impl<C, V, S> RefUnwindSafe for Rc<C, V, S>
impl<C, V, S> Unpin for Rc<C, V, S>
impl<C, V, S> UnwindSafe for Rc<C, V, S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)