[−][src]Struct heaparray::naive_rc::generic::RcArray
RcArray
is a generic, implementation-agnositc array. It contains
logic for enforcing type safety.
The type parameters are, in order:
A: A struct that acts as a reference to an array.
R: A reference-counting structure, that wraps the label. Note that this
*can be the label itself*. It just needs to have defined ways of incrementing
and decrementing its reference count.
E: The elements that this array contains.
L: The label that is associated with this array.
Methods
impl<A, R, E, L> RcArray<A, R, E, L> where
A: LabelledArray<E, R>,
R: RefCounter<L>,
[src]
A: LabelledArray<E, R>,
R: RefCounter<L>,
pub fn ref_count(&self) -> usize
[src]
Returns the reference count of the data this RcArray
points to.
pub fn to_owned(self) -> Result<A, Self>
[src]
Returns an owned version of this array if the caller has exclusive access, or returns back this reference otherwise.
pub fn to_mut(&mut self) -> Option<&mut A>
[src]
Returns a mutable reference to the array if the caller has exclusive access,
or None
otherwise.
impl<A, R, E, L> RcArray<A, R, E, L> where
A: LabelledArray<E, R> + Clone,
R: RefCounter<L>,
[src]
A: LabelledArray<E, R> + Clone,
R: RefCounter<L>,
pub fn make_owned(self) -> A
[src]
Returns an owned version of this array if the caller has exclusive access, or copies the data otherwise.
pub fn make_mut(&mut self) -> &mut A
[src]
Returns a mutable reference to the array if the caller has exclusive access, or copies the data otherwise.
Trait Implementations
impl<A, R, E, L> ArrayRef for RcArray<A, R, E, L> where
A: LabelledArray<E, R>,
R: RefCounter<L>,
[src]
A: LabelledArray<E, R>,
R: RefCounter<L>,
fn clone(ptr: &Self) -> Self
[src]
Clones the array reference. Internally just calls its .clone()
method. Read more
impl<A, R, E, L> LabelledArray<E, L> for RcArray<A, R, E, L> where
A: LabelledArray<E, R>,
R: RefCounter<L>,
[src]
A: LabelledArray<E, R>,
R: RefCounter<L>,
fn with_label<F>(label: L, len: usize, func: F) -> Self where
F: FnMut(&mut L, usize) -> E,
[src]
F: FnMut(&mut L, usize) -> E,
fn get_label(&self) -> &L
[src]
unsafe fn get_unchecked(&self, idx: usize) -> &E
[src]
impl<A, R, E, L> DefaultLabelledArray<E, L> for RcArray<A, R, E, L> where
A: DefaultLabelledArray<E, R> + LabelledArray<E, R>,
R: RefCounter<L>,
E: Default,
[src]
A: DefaultLabelledArray<E, R> + LabelledArray<E, R>,
R: RefCounter<L>,
E: Default,
impl<A, R, E> MakeArray<E> for RcArray<A, R, E, ()> where
A: LabelledArray<E, R>,
R: RefCounter<()>,
[src]
A: LabelledArray<E, R>,
R: RefCounter<()>,
impl<A, R, E, L> SliceArray<E> for RcArray<A, R, E, L> where
A: LabelledArray<E, R> + SliceArray<E>,
R: RefCounter<L>,
[src]
A: LabelledArray<E, R> + SliceArray<E>,
R: RefCounter<L>,
impl<A, R, E, L> Send for RcArray<A, R, E, L> where
A: LabelledArray<E, R> + Send + Sync,
R: RefCounter<L> + Send + Sync,
E: Send + Sync,
L: Send + Sync,
[src]
A: LabelledArray<E, R> + Send + Sync,
R: RefCounter<L> + Send + Sync,
E: Send + Sync,
L: Send + Sync,
impl<A, R, E, L> Drop for RcArray<A, R, E, L> where
A: LabelledArray<E, R>,
R: RefCounter<L>,
[src]
A: LabelledArray<E, R>,
R: RefCounter<L>,
impl<'b, A, R, E, L> IntoIterator for &'b RcArray<A, R, E, L> where
A: LabelledArray<E, R> + SliceArray<E>,
R: RefCounter<L>,
[src]
A: LabelledArray<E, R> + SliceArray<E>,
R: RefCounter<L>,
type Item = &'b E
The type of the elements being iterated over.
type IntoIter = Iter<'b, E>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<A, R, E, L> Sync for RcArray<A, R, E, L> where
A: LabelledArray<E, R> + Send + Sync,
R: RefCounter<L> + Send + Sync,
E: Send + Sync,
L: Send + Sync,
[src]
A: LabelledArray<E, R> + Send + Sync,
R: RefCounter<L> + Send + Sync,
E: Send + Sync,
L: Send + Sync,
impl<A, R, E, L> Clone for RcArray<A, R, E, L> where
A: LabelledArray<E, R>,
R: RefCounter<L>,
[src]
A: LabelledArray<E, R>,
R: RefCounter<L>,
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<A, R, E, L> Index<usize> for RcArray<A, R, E, L> where
A: LabelledArray<E, R> + Index<usize, Output = E>,
R: RefCounter<L>,
[src]
A: LabelledArray<E, R> + Index<usize, Output = E>,
R: RefCounter<L>,
impl<A, R, E, L> Debug for RcArray<A, R, E, L> where
A: LabelledArray<E, R> + SliceArray<E>,
R: RefCounter<L>,
E: Debug,
L: Debug,
[src]
A: LabelledArray<E, R> + SliceArray<E>,
R: RefCounter<L>,
E: Debug,
L: Debug,
impl<A, R, E, L> Container for RcArray<A, R, E, L> where
A: LabelledArray<E, R>,
R: RefCounter<L>,
[src]
A: LabelledArray<E, R>,
R: RefCounter<L>,
impl<A, R, E, L> CopyMap<usize, E> for RcArray<A, R, E, L> where
A: LabelledArray<E, R>,
R: RefCounter<L>,
[src]
A: LabelledArray<E, R>,
R: RefCounter<L>,
fn get(&self, key: usize) -> Option<&E>
[src]
Get a reference into this array. Returns None
if:
- The index given is out-of-bounds
fn get_mut(&mut self, key: usize) -> Option<&mut E>
[src]
Get a mutable reference into this array. Returns None
if:
- The array is referenced by another pointer
- The index given is out-of-bounds
fn insert(&mut self, key: usize, value: E) -> Option<E>
[src]
Insert an element into this array. Returns None
if:
- The array is referenced by another pointer
- The index given is out-of-bounds
- There was nothing in the slot previously
Auto Trait Implementations
impl<A, R, E, L> Unpin for RcArray<A, R, E, L> where
A: Unpin,
E: Unpin,
L: Unpin,
R: Unpin,
A: Unpin,
E: Unpin,
L: Unpin,
R: Unpin,
impl<A, R, E, L> UnwindSafe for RcArray<A, R, E, L> where
A: UnwindSafe,
E: UnwindSafe,
L: UnwindSafe,
R: UnwindSafe,
A: UnwindSafe,
E: UnwindSafe,
L: UnwindSafe,
R: UnwindSafe,
impl<A, R, E, L> RefUnwindSafe for RcArray<A, R, E, L> where
A: RefUnwindSafe,
E: RefUnwindSafe,
L: RefUnwindSafe,
R: RefUnwindSafe,
A: RefUnwindSafe,
E: RefUnwindSafe,
L: RefUnwindSafe,
R: RefUnwindSafe,
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &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, 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.
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.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,