[−][src]Struct mop_structs::vec::VecArray
A structure just like Vec
, the difference is the inner storage
provided by an array.
Methods
impl<A> VecArray<A> where
A: Array,
[src]
A: Array,
pub fn new(array: A, len: usize) -> Self
[src]
Creates a new VecArray
from a provided array and length.
Arguments
array
- The array storage
Examples
use mop_structs::vec::VecArray; let _ = VecArray::new([1, 2, 3, 4, 5], 2);
pub fn new_rnd<F, R>(len: usize, rng: &mut R, cb: F) -> Self where
F: FnMut(&mut R, usize) -> A::Item,
R: Rng,
[src]
F: FnMut(&mut R, usize) -> A::Item,
R: Rng,
pub fn with_array(array: A) -> Self
[src]
Creates a new VecArray
from a provided array.
Then length of Self
will be the length of array
.
Examples
use mop_structs::vec::VecArray; let _ = VecArray::with_array([0; 10]);
pub fn with_capacity() -> Self
[src]
Creates a new empty VecArray
from an array type.
Examples
use mop_structs::vec::VecArray; let _ = VecArray::<[i32; 10]>::with_capacity();
pub fn array(&self) -> &A
[src]
pub fn len(&self) -> usize
[src]
pub fn try_push(&mut self, item: A::Item) -> bool
[src]
Trait Implementations
impl<A> DynDenseSto for VecArray<A> where
A: Array,
[src]
A: Array,
impl<A> DynDenseStoMut for VecArray<A> where
A: Array,
[src]
A: Array,
fn clear(&mut self)
[src]
Examples
use mop_structs::{ doc_tests::vec_array, prelude::*, }; let mut a = vec_array(); a.clear(); assert_eq!(&a, &[]);
fn extend(&mut self, other: &[Self::Item]) where
Self::Item: Copy,
[src]
Self::Item: Copy,
Examples
use mop_structs::{ doc_tests::vec_array, prelude::*, }; let mut a = vec_array(); a.extend(&[1, 2]); assert_eq!(&a, &[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2]);
fn extend_from_clone(&mut self, other: &[Self::Item]) where
Self::Item: Clone,
[src]
Self::Item: Clone,
Examples
use mop_structs::{ doc_tests::vec_array, prelude::*, }; let mut a = vec_array(); a.extend_from_clone(&[1, 2]); assert_eq!(&a, &[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2]);
fn push(&mut self, item: A::Item)
[src]
Examples
use mop_structs::{ doc_tests::vec_array, prelude::*, }; let mut a = vec_array(); a.push(100); assert_eq!(&a, &[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 100]);
fn swap(&mut self, a: usize, b: usize)
[src]
Examples
use mop_structs::{ doc_tests::vec_array, prelude::*, }; let mut a = vec_array(); a.swap(0, 2); assert_eq!(&a, &[3, 2, 1, 4, 5, 6, 7, 8, 9, 10]);
fn truncate(&mut self, idx: usize)
[src]
Examples
use mop_structs::{ doc_tests::vec_array, prelude::*, }; let mut a = vec_array(); a.truncate(2); assert_eq!(&a, &[1, 2]);
impl<A> DynDenseStoRef for VecArray<A> where
A: Array,
[src]
A: Array,
fn capacity(&self) -> usize
[src]
Examples
use mop_structs::{ doc_tests::vec_array, prelude::*, }; assert_eq!(vec_array().capacity(), 16);
impl<A> StDenseStoMut for VecArray<A> where
A: Array,
[src]
A: Array,
fn as_mut_slice(&mut self) -> &mut [A::Item]
[src]
Examples
use mop_structs::{ doc_tests::vec_array, prelude::*, }; assert_eq!(vec_array().as_mut_slice(), &mut [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
impl<A> StDenseStoRef for VecArray<A> where
A: Array,
[src]
A: Array,
type Item = A::Item
fn as_slice(&self) -> &[A::Item]
[src]
Examples
use mop_structs::{ doc_tests::vec_array, prelude::*, }; assert_eq!(&vec_array(), &[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
impl<A> AsRef<[<A as Array>::Item]> for VecArray<A> where
A: Array,
[src]
A: Array,
impl<A> AsMut<[<A as Array>::Item]> for VecArray<A> where
A: Array,
[src]
A: Array,
impl<A: Eq> Eq for VecArray<A>
[src]
impl<A: Copy> Copy for VecArray<A>
[src]
impl<A: Clone> Clone for VecArray<A>
[src]
fn clone(&self) -> VecArray<A>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<A: PartialEq> PartialEq<VecArray<A>> for VecArray<A>
[src]
impl<A: PartialOrd> PartialOrd<VecArray<A>> for VecArray<A>
[src]
fn partial_cmp(&self, other: &VecArray<A>) -> Option<Ordering>
[src]
fn lt(&self, other: &VecArray<A>) -> bool
[src]
fn le(&self, other: &VecArray<A>) -> bool
[src]
fn gt(&self, other: &VecArray<A>) -> bool
[src]
fn ge(&self, other: &VecArray<A>) -> bool
[src]
impl<A: Default> Default for VecArray<A>
[src]
impl<'a, A> IntoIterator for &'a VecArray<A> where
A: Array,
[src]
A: Array,
type Item = &'a A::Item
The type of the elements being iterated over.
type IntoIter = Iter<'a, A::Item>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<'a, A> IntoIterator for &'a mut VecArray<A> where
A: Array,
[src]
A: Array,
type Item = &'a mut A::Item
The type of the elements being iterated over.
type IntoIter = IterMut<'a, A::Item>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<A: Hash> Hash for VecArray<A>
[src]
fn hash<__HA: Hasher>(&self, state: &mut __HA)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<A> Deref for VecArray<A> where
A: Array,
[src]
A: Array,
impl<A> DerefMut for VecArray<A> where
A: Array,
[src]
A: Array,
impl<A> Debug for VecArray<A> where
A: Array,
A::Item: Debug,
[src]
A: Array,
A::Item: Debug,
impl<A> FromIterator<<A as Array>::Item> for VecArray<A> where
A: Array,
[src]
A: Array,
fn from_iter<I>(iter: I) -> Self where
I: IntoIterator<Item = A::Item>,
[src]
I: IntoIterator<Item = A::Item>,
impl<A> Borrow<[<A as Array>::Item]> for VecArray<A> where
A: Array,
[src]
A: Array,
impl<A> BorrowMut<[<A as Array>::Item]> for VecArray<A> where
A: Array,
[src]
A: Array,
fn borrow_mut(&mut self) -> &mut [A::Item]
[src]
impl<A> Serialize for VecArray<A> where
A: Array,
A::Item: Serialize,
[src]
A: Array,
A::Item: Serialize,
impl<'de, A> Deserialize<'de> for VecArray<A> where
A: Array,
A::Item: Deserialize<'de>,
[src]
A: Array,
A::Item: Deserialize<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
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, U> TryFrom 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 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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,