Struct atone::CustomVc

source ·
pub struct CustomVc<T, const R: usize = { default_r() }> { /* private fields */ }
Expand description

A VecDeque (and Vec) variant that spreads resize load across pushes.

This variant differs from Vc in that you can customize the incremental resize chunk size (R).

See the crate-level documentation for details.

Implementations§

source§

impl<T, const R: usize> CustomVc<T, R>

source

pub fn new() -> Self

Creates an empty Vc.

Examples
use atone::Vc;

let vector: Vc<u32> = Vc::new();
source

pub const fn move_amount() -> usize

The incremental resize chunk size used by this Vc

source

pub fn with_capacity(capacity: usize) -> Self

Creates an empty Vc with space for at least capacity elements.

Examples
use atone::Vc;

let vector: Vc<u32> = Vc::with_capacity(10);
source

pub fn first(&self) -> Option<&T>

Returns the first element of the Vc, or None if it is empty.

Examples
use atone::Vc;

let mut v = Vc::new();
v.push_back(10);
v.push_back(40);
v.push_back(30);
assert_eq!(Some(&10), v.first());

v.clear();
assert_eq!(None, v.first());
source

pub fn first_mut(&mut self) -> Option<&mut T>

Returns a mutable pointer to the first element of the Vc, or None if it is empty.

Examples
use atone::Vc;

let mut x = Vc::new();
x.push_back(0);
x.push_back(1);
x.push_back(2);

if let Some(last) = x.first_mut() {
    *last = 5;
}
assert_eq!(x, vec![5, 1, 2]);
source

pub fn last(&self) -> Option<&T>

Returns the last element of the Vc, or None if it is empty.

Examples
use atone::Vc;

let mut v = Vc::new();
v.push_back(10);
v.push_back(40);
v.push_back(30);
assert_eq!(Some(&30), v.last());

v.clear();
assert_eq!(None, v.last());
source

pub fn last_mut(&mut self) -> Option<&mut T>

Returns a mutable pointer to the last item in the Vc.

Examples
use atone::Vc;

let mut x = Vc::new();
x.push_back(0);
x.push_back(1);
x.push_back(2);

if let Some(last) = x.last_mut() {
    *last = 10;
}
assert_eq!(x, vec![0, 1, 10]);
source

pub fn get(&self, index: usize) -> Option<&T>

Provides a reference to the element at the given index.

Element at index 0 is the front of the queue.

Examples
use atone::Vc;

let mut buf = Vc::new();
buf.push_back(3);
buf.push_back(4);
buf.push_back(5);
assert_eq!(buf.get(1), Some(&4));
source

pub fn get_mut(&mut self, index: usize) -> Option<&mut T>

Provides a mutable reference to the element at the given index.

Element at index 0 is the front of the queue.

Examples
use atone::Vc;

let mut buf = Vc::new();
buf.push_back(3);
buf.push_back(4);
buf.push_back(5);
if let Some(elem) = buf.get_mut(1) {
    *elem = 7;
}

assert_eq!(buf[1], 7);
source

pub fn swap(&mut self, i: usize, j: usize)

Swaps elements at indices i and j.

i and j may be equal.

Element at index 0 is the front of the queue.

Panics

Panics if either index is out of bounds.

Examples
use atone::Vc;

let mut buf = Vc::new();
buf.push_back(3);
buf.push_back(4);
buf.push_back(5);
assert_eq!(buf, vec![3, 4, 5]);
buf.swap(0, 2);
assert_eq!(buf, vec![5, 4, 3]);
source

pub fn reverse(&mut self)

Reverses the order of elements in the Vc, in place.

Examples
use atone::Vc;
use std::iter::FromIterator;

let mut v: Vc<_> = (1..=3).collect();
v.reverse();
assert_eq!(v, vec![3, 2, 1]);
source

pub fn capacity(&self) -> usize

Returns the number of elements the Vc can hold without reallocating.

Examples
use atone::Vc;

let buf: Vc<i32> = Vc::with_capacity(10);
assert!(buf.capacity() >= 10);
source

pub fn reserve_exact(&mut self, additional: usize)

Reserves the minimum capacity for exactly additional more elements to be inserted in the given Vc. Does nothing if the capacity is already sufficient.

Note that the allocator may give the collection more space than it requests. Therefore capacity can not be relied upon to be precisely minimal. Prefer [reserve] if future insertions are expected.

While we try to make this incremental where possible, it may require all-at-once resizing.

Panics

Panics if the new capacity overflows usize.

Examples
use atone::Vc;

let mut buf: Vc<i32> = vec![1].into_iter().collect();
buf.reserve_exact(10);
assert!(buf.capacity() >= 11);
source

pub fn reserve(&mut self, additional: usize)

Reserves capacity for at least additional more elements to be inserted in the given Vc. The collection may reserve more space to avoid frequent reallocations.

While we try to make this incremental where possible, it may require all-at-once resizing.

Panics

Panics if the new capacity overflows usize.

Examples
use atone::Vc;

let mut buf: Vc<i32> = vec![1].into_iter().collect();
buf.reserve(10);
assert!(buf.capacity() >= 11);
source

pub fn shrink_to_fit(&mut self)

Shrinks the capacity of the Vc as much as possible.

It will drop down as close as possible to the length but the allocator may still inform the Vc that there is space for a few more elements.

Examples
use atone::Vc;

let mut buf = Vc::with_capacity(15);
buf.extend(0..4);
assert_eq!(buf.capacity(), 15);
buf.shrink_to_fit();
assert!(buf.capacity() >= 4);
assert!(buf.capacity() < 15);
source

pub fn truncate(&mut self, len: usize)

Shortens the Vc, keeping the first len elements and dropping the rest.

If len is greater than the Vc’s current length, this has no effect.

Examples
use atone::Vc;

let mut buf = Vc::new();
buf.push_back(5);
buf.push_back(10);
buf.push_back(15);
assert_eq!(buf, vec![5, 10, 15]);
buf.truncate(1);
assert_eq!(buf, vec![5]);
source

pub fn iter(&self) -> Iter<'_, T>

Returns a front-to-back iterator.

Examples
use atone::Vc;

let mut buf = Vc::new();
buf.push_back(5);
buf.push_back(3);
buf.push_back(4);
let b: &[_] = &[&5, &3, &4];
let c: Vec<&i32> = buf.iter().collect();
assert_eq!(&c[..], b);
source

pub fn iter_mut(&mut self) -> IterMut<'_, T>

Returns a front-to-back iterator that returns mutable references.

Examples
use atone::Vc;

let mut buf = Vc::new();
buf.push_back(5);
buf.push_back(3);
buf.push_back(4);
for num in buf.iter_mut() {
    *num = *num - 2;
}
let b: &[_] = &[&mut 3, &mut 1, &mut 2];
assert_eq!(&buf.iter_mut().collect::<Vec<&mut i32>>()[..], b);
source

pub fn as_single_slice(&self) -> Option<&[T]>

Returns the single slice which contains, in order, the contents of the Vc, if possible.

You will likely want to call make_contiguous before calling this method to ensure that this method returns Some.

Examples
use atone::Vc;
let mut vector = Vc::with_capacity(3);

vector.push(0);
vector.push(1);
vector.push(2);

assert_eq!(vector.as_single_slice(), Some(&[0, 1, 2][..]));

// Push enough items, and the memory is no longer
// contiguous due to incremental resizing.
for i in 3..16 {
    vector.push(i);
}

assert_eq!(vector.as_single_slice(), None);

vector.make_contiguous();
assert_eq!(vector.as_single_slice(), Some(&(0..16).collect::<Vec<_>>()[..]));
source

pub fn len(&self) -> usize

Returns the number of elements in the Vc.

Examples
use atone::Vc;

let mut v = Vc::new();
assert_eq!(v.len(), 0);
v.push_back(1);
assert_eq!(v.len(), 1);
source

pub fn is_empty(&self) -> bool

Returns true if the Vc is empty.

Examples
use atone::Vc;

let mut v = Vc::new();
assert!(v.is_empty());
v.push(1);
assert!(!v.is_empty());
source

pub fn range<Range>(&self, range: Range) -> Iter<'_, T>
where Range: RangeBounds<usize>,

Creates an iterator that covers the specified range in the VecDeque.

Panics

Panics if the starting point is greater than the end point or if the end point is greater than the length of the vector.

Examples
use atone::Vc;

let v: Vc<_> = vec![1, 2, 3].into_iter().collect();
let range = v.range(2..).copied().collect::<Vc<_>>();
assert_eq!(range, vec![3]);

// A full range covers all contents
let all = v.range(..);
assert_eq!(all.len(), 3);
source

pub fn range_mut<Range>(&mut self, range: Range) -> IterMut<'_, T>
where Range: RangeBounds<usize>,

Creates an iterator that covers the specified mutable range in the VecDeque.

Panics

Panics if the starting point is greater than the end point or if the end point is greater than the length of the vector.

Examples
use atone::Vc;

let mut v: Vc<_> = vec![1, 2, 3].into_iter().collect();
for v in v.range_mut(2..) {
  *v *= 2;
}
assert_eq!(v, vec![1, 2, 6]);

// A full range covers all contents
for v in v.range_mut(..) {
  *v *= 2;
}
assert_eq!(v, vec![2, 4, 12]);
source

pub fn drain<Range>(&mut self, range: Range) -> Drain<'_, T>
where Range: RangeBounds<usize>,

Creates a draining iterator that removes the specified range in the Vc and yields the removed items.

Note 1: The element range is removed even if the iterator is not consumed until the end.

Note 2: It is unspecified how many elements are removed from the deque, if the Drain value is not dropped, but the borrow it holds expires (e.g., due to mem::forget).

Panics

Panics if the starting point is greater than the end point or if the end point is greater than the length of the vector.

Examples
use atone::Vc;

let mut v: Vc<_> = vec![1, 2, 3].into_iter().collect();
let drained = v.drain(2..).collect::<Vc<_>>();
assert_eq!(drained, vec![3]);
assert_eq!(v, vec![1, 2]);

// A full range clears all contents
v.drain(..);
assert!(v.is_empty());
source

pub fn clear(&mut self)

Clears the Vc, removing all values.

Examples
use atone::Vc;

let mut v = Vc::new();
v.push_back(1);
v.clear();
assert!(v.is_empty());
source

pub fn contains(&self, x: &T) -> bool
where T: PartialEq<T>,

Returns true if the Vc contains an element equal to the given value.

Examples
use atone::Vc;

let mut vector: Vc<u32> = Vc::new();

vector.push_back(0);
vector.push_back(1);

assert_eq!(vector.contains(&1), true);
assert_eq!(vector.contains(&10), false);
source

pub fn front(&self) -> Option<&T>

Provides a reference to the front element, or None if the Vc is empty.

Examples
use atone::Vc;

let mut d = Vc::new();
assert_eq!(d.front(), None);

d.push_back(1);
d.push_back(2);
assert_eq!(d.front(), Some(&1));
source

pub fn front_mut(&mut self) -> Option<&mut T>

Provides a mutable reference to the front element, or None if the Vc is empty.

Examples
use atone::Vc;

let mut d = Vc::new();
assert_eq!(d.front_mut(), None);

d.push_back(1);
d.push_back(2);
match d.front_mut() {
    Some(x) => *x = 9,
    None => (),
}
assert_eq!(d.front(), Some(&9));
source

pub fn back(&self) -> Option<&T>

Provides a reference to the back element, or None if the Vc is empty.

Examples
use atone::Vc;

let mut d = Vc::new();
assert_eq!(d.back(), None);

d.push_back(1);
d.push_back(2);
assert_eq!(d.back(), Some(&2));
source

pub fn back_mut(&mut self) -> Option<&mut T>

Provides a mutable reference to the back element, or None if the Vc is empty.

Examples
use atone::Vc;

let mut d = Vc::new();
assert_eq!(d.back(), None);

d.push_back(1);
d.push_back(2);
match d.back_mut() {
    Some(x) => *x = 9,
    None => (),
}
assert_eq!(d.back(), Some(&9));
source

pub fn pop_front(&mut self) -> Option<T>

Removes the first element and returns it, or None if the Vc is empty.

Examples
use atone::Vc;

let mut d = Vc::new();
d.push_back(1);
d.push_back(2);

assert_eq!(d.pop_front(), Some(1));
assert_eq!(d.pop_front(), Some(2));
assert_eq!(d.pop_front(), None);
source

pub fn pop_back(&mut self) -> Option<T>

Removes the last element from the Vc and returns it, or None if it is empty.

Examples
use atone::Vc;

let mut buf = Vc::new();
assert_eq!(buf.pop_back(), None);
buf.push_back(1);
buf.push_back(3);
assert_eq!(buf.pop_back(), Some(3));
source

pub fn pop(&mut self) -> Option<T>

Removes the last element from the Vc and returns it, or None if it is empty.

Examples
let mut vec = vec![1, 2, 3];
assert_eq!(vec.pop(), Some(3));
assert_eq!(vec, [1, 2]);
source

pub fn push_back(&mut self, value: T)

Appends an element to the back of the Vc.

Examples
use atone::Vc;

let mut buf = Vc::new();
buf.push_back(1);
buf.push_back(3);
assert_eq!(3, *buf.back().unwrap());
source

pub fn push(&mut self, value: T)

Appends an element to the back of the Vc.

Panics

Panics if the number of elements in the vector overflows a usize.

Examples
let mut vec = vec![1, 2];
vec.push(3);
assert_eq!(vec, [1, 2, 3]);
source

pub fn swap_remove_front(&mut self, index: usize) -> Option<T>

Removes an element from anywhere in the Vc and returns it, replacing it with the first element.

This does not preserve ordering, but is O(1).

Returns None if index is out of bounds.

Element at index 0 is the front of the queue.

Examples
use atone::Vc;

let mut buf = Vc::new();
assert_eq!(buf.swap_remove_front(0), None);
buf.push_back(1);
buf.push_back(2);
buf.push_back(3);
assert_eq!(buf, vec![1, 2, 3]);

assert_eq!(buf.swap_remove_front(2), Some(3));
assert_eq!(buf, vec![2, 1]);
source

pub fn swap_remove_back(&mut self, index: usize) -> Option<T>

Removes an element from anywhere in the Vc and returns it, replacing it with the last element.

This does not preserve ordering, but is O(1).

Returns None if index is out of bounds.

Element at index 0 is the front of the queue.

Examples
use atone::Vc;

let mut buf = Vc::new();
assert_eq!(buf.swap_remove_back(0), None);
buf.push_back(1);
buf.push_back(2);
buf.push_back(3);
assert_eq!(buf, vec![1, 2, 3]);

assert_eq!(buf.swap_remove_back(0), Some(1));
assert_eq!(buf, vec![3, 2]);
source

pub fn swap_remove(&mut self, index: usize) -> T

Removes an element from the vector and returns it.

The removed element is replaced by the last element of the vector.

This does not preserve ordering, but is O(1).

Panics

Panics if index is out of bounds.

Examples
let mut v = vec!["foo", "bar", "baz", "qux"];

assert_eq!(v.swap_remove(1), "bar");
assert_eq!(v, ["foo", "qux", "baz"]);

assert_eq!(v.swap_remove(0), "foo");
assert_eq!(v, ["baz", "qux"]);
source

pub fn insert(&mut self, index: usize, value: T)

Inserts an element at index within the Vc, shifting all elements with indices greater than or equal to index towards the back.

Element at index 0 is the front of the queue.

Panics

Panics if index is greater than Vc’s length

Examples
use atone::Vc;

let mut vec_deque = Vc::new();
vec_deque.push_back('a');
vec_deque.push_back('b');
vec_deque.push_back('c');
assert_eq!(vec_deque, vec!['a', 'b', 'c']);

vec_deque.insert(1, 'd');
assert_eq!(vec_deque, vec!['a', 'd', 'b', 'c']);
source

pub fn push_front(&mut self, value: T)

Inserts an element at the front of the queue, shifting all elements with indices greater than or equal to index towards the back.

Panics

Panics if index is greater than Vc’s length

Examples
use atone::Vc;

let mut vec_deque = Vc::new();
vec_deque.push_front('a');
vec_deque.push_front('b');
vec_deque.push_front('c');
assert_eq!(vec_deque, vec!['c', 'b', 'a']);

vec_deque.insert(1, 'd');
assert_eq!(vec_deque, vec!['c', 'd', 'b', 'a']);
source

pub fn remove(&mut self, index: usize) -> T

Removes and returns the element at index from the Vc. Whichever end is closer to the removal point will be moved to make room, and all the affected elements will be moved to new positions.

Panics

Panics if index is out of bounds.

Examples
use atone::Vc;

let mut buf = Vc::new();
buf.push_back(1);
buf.push_back(2);
buf.push_back(3);
assert_eq!(buf, vec![1, 2, 3]);

assert_eq!(buf.remove(1), 2);
assert_eq!(buf, vec![1, 3]);
source

pub fn split_off(&mut self, at: usize) -> Self

Splits the Vc into two at the given index.

Returns a newly allocated Vc. self contains elements [0, at), and the returned Vc contains elements [at, len).

Note that the capacity of self does not change.

Element at index 0 is the front of the queue.

Panics

Panics if at > len.

Examples
use atone::Vc;

let mut buf: Vc<_> = vec![1,2,3].into_iter().collect();
let buf2 = buf.split_off(1);
assert_eq!(buf, vec![1]);
assert_eq!(buf2, vec![2, 3]);
source

pub fn append(&mut self, other: &mut Self)

Moves all the elements of other into self, leaving other empty.

Panics

Panics if the new number of elements in self overflows a usize.

Examples
use atone::Vc;

let mut buf: Vc<_> = vec![1, 2].into_iter().collect();
let mut buf2: Vc<_> = vec![3, 4].into_iter().collect();
buf.append(&mut buf2);
assert_eq!(buf, vec![1, 2, 3, 4]);
assert_eq!(buf2, vec![]);
source

pub fn retain<F>(&mut self, f: F)
where F: FnMut(&T) -> bool,

Retains only the elements specified by the predicate.

In other words, remove all elements e such that f(&e) returns false. This method operates in place, visiting each element exactly once in the original order, and preserves the order of the retained elements.

Examples
use atone::Vc;

let mut buf = Vc::new();
buf.extend(1..5);
buf.retain(|&x| x % 2 == 0);
assert_eq!(buf, vec![2, 4]);

The exact order may be useful for tracking external state, like an index.

use atone::Vc;

let mut buf = Vc::new();
buf.extend(1..6);

let keep = [false, true, true, false, true];
let mut i = 0;
buf.retain(|_| (keep[i], i += 1).0);
assert_eq!(buf, vec![2, 3, 5]);
source

pub fn resize_with(&mut self, new_len: usize, generator: impl FnMut() -> T)

Modifies the Vc in-place so that len() is equal to new_len, either by removing excess elements from the back or by appending elements generated by calling generator to the back.

Examples
use atone::Vc;

let mut buf = Vc::new();
buf.push_back(5);
buf.push_back(10);
buf.push_back(15);
assert_eq!(buf, vec![5, 10, 15]);

buf.resize_with(5, Default::default);
assert_eq!(buf, vec![5, 10, 15, 0, 0]);

buf.resize_with(2, || unreachable!());
assert_eq!(buf, vec![5, 10]);

let mut state = 100;
buf.resize_with(5, || { state += 1; state });
assert_eq!(buf, vec![5, 10, 101, 102, 103]);
source

pub fn make_contiguous(&mut self) -> &mut [T]

Rearranges the internal storage so that all elements are in one contiguous slice, which is then returned.

This method does not allocate and does not change the order of the inserted elements. As it returns a mutable slice, this can be used to sort or binary search a deque.

This method will also move over leftover items from the last resize, if any.

Examples

Sorting the content of a deque.

use atone::Vc;

let mut buf = Vc::with_capacity(3);
for i in 1..=16 {
    buf.push(16 - i);
}

// The backing memory of buf is now split,
// since some items are left over after the resize.
// To sort the list, we make it contiguous, and then sort.
buf.make_contiguous().sort();
assert_eq!(buf, (0..16).collect::<Vec<_>>());

// Similarly, we can sort it in reverse order.
buf.make_contiguous().sort_by(|a, b| b.cmp(a));
assert_eq!(buf, (1..=16).map(|i| 16 - i).collect::<Vec<_>>());

Getting immutable access to the contiguous slice.

use atone::Vc;
let mut buf = Vc::new();
for i in 1..=3 {
    buf.push(i);
}

buf.make_contiguous();
if let Some(slice) = buf.as_single_slice() {
    // we can now be sure that `slice` contains all elements of the deque,
    // while still having immutable access to `buf`.
    assert_eq!(buf.len(), slice.len());
    assert_eq!(slice, &[1, 2, 3] as &[_]);
}
source§

impl<T: Clone, const R: usize> CustomVc<T, R>

source

pub fn resize(&mut self, new_len: usize, value: T)

Modifies the Vc in-place so that len() is equal to new_len, either by removing excess elements from the back or by appending clones of value to the back.

Examples
use atone::Vc;

let mut buf = Vc::new();
buf.push_back(5);
buf.push_back(10);
buf.push_back(15);
assert_eq!(buf, vec![5, 10, 15]);

buf.resize(2, 0);
assert_eq!(buf, vec![5, 10]);

buf.resize(5, 20);
assert_eq!(buf, vec![5, 10, 20, 20, 20]);

Trait Implementations§

source§

impl<T: Clone, const R: usize> Clone for CustomVc<T, R>

source§

fn clone(&self) -> CustomVc<T, R>

Returns a copy of the value. Read more
source§

fn clone_from(&mut self, other: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Debug, const R: usize> Debug for CustomVc<T, R>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T, const R: usize> Default for CustomVc<T, R>

source§

fn default() -> Self

Creates an empty Vc<T>.

source§

impl<'a, T: 'a + Copy, const R: usize> Extend<&'a T> for CustomVc<T, R>

source§

fn extend<I: IntoIterator<Item = &'a T>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl<A, const R: usize> Extend<A> for CustomVc<A, R>

source§

fn extend<T: IntoIterator<Item = A>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl<T, const R: usize> From<CustomVc<T, R>> for Vec<T>

source§

fn from(other: CustomVc<T, R>) -> Self

Converts to this type from the input type.
source§

impl<T, const R: usize> From<CustomVc<T, R>> for VecDeque<T>

source§

fn from(other: CustomVc<T, R>) -> Self

Converts to this type from the input type.
source§

impl<T, const R: usize> From<Vec<T>> for CustomVc<T, R>

source§

fn from(other: Vec<T>) -> Self

Converts to this type from the input type.
source§

impl<T, const R: usize> From<VecDeque<T>> for CustomVc<T, R>

source§

fn from(other: VecDeque<T>) -> Self

Converts to this type from the input type.
source§

impl<A, const R: usize> FromIterator<A> for CustomVc<A, R>

source§

fn from_iter<T: IntoIterator<Item = A>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

impl<A: Hash, const R: usize> Hash for CustomVc<A, R>

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<A, const R: usize> Index<usize> for CustomVc<A, R>

§

type Output = A

The returned type after indexing.
source§

fn index(&self, index: usize) -> &A

Performs the indexing (container[index]) operation. Read more
source§

impl<A, const R: usize> IndexMut<usize> for CustomVc<A, R>

source§

fn index_mut(&mut self, index: usize) -> &mut A

Performs the mutable indexing (container[index]) operation. Read more
source§

impl<'a, T, const R: usize> IntoIterator for &'a CustomVc<T, R>

§

type Item = &'a T

The type of the elements being iterated over.
§

type IntoIter = Iter<'a, T>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Iter<'a, T>

Creates an iterator from a value. Read more
source§

impl<'a, T, const R: usize> IntoIterator for &'a mut CustomVc<T, R>

§

type Item = &'a mut T

The type of the elements being iterated over.
§

type IntoIter = IterMut<'a, T>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> IterMut<'a, T>

Creates an iterator from a value. Read more
source§

impl<T, const R: usize> IntoIterator for CustomVc<T, R>

§

type Item = T

The type of the elements being iterated over.
§

type IntoIter = IntoIter<T>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> IntoIter<T>

Creates an iterator from a value. Read more
source§

impl<A: Ord, const R: usize> Ord for CustomVc<A, R>

source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl<A, B, const R: usize> PartialEq<&[B]> for CustomVc<A, R>
where A: PartialEq<B>,

source§

fn eq(&self, other: &&[B]) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<A, B, const R: usize> PartialEq<&mut [B]> for CustomVc<A, R>
where A: PartialEq<B>,

source§

fn eq(&self, other: &&mut [B]) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<A, B, const R: usize> PartialEq<CustomVc<A, R>> for &[B]
where A: PartialEq<B>,

source§

fn eq(&self, other: &CustomVc<A, R>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<A, B, const R: usize> PartialEq<CustomVc<A, R>> for &mut [B]
where A: PartialEq<B>,

source§

fn eq(&self, other: &CustomVc<A, R>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<A, B, const R: usize> PartialEq<CustomVc<A, R>> for Vec<B>
where A: PartialEq<B>,

source§

fn eq(&self, other: &CustomVc<A, R>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<A, B, const R: usize> PartialEq<Vec<B>> for CustomVc<A, R>
where A: PartialEq<B>,

source§

fn eq(&self, other: &Vec<B>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<A: PartialEq, const R: usize> PartialEq for CustomVc<A, R>

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<A: PartialOrd, const R: usize> PartialOrd for CustomVc<A, R>

source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<A: Eq, const R: usize> Eq for CustomVc<A, R>

Auto Trait Implementations§

§

impl<T, const R: usize> RefUnwindSafe for CustomVc<T, R>
where T: RefUnwindSafe,

§

impl<T, const R: usize> Send for CustomVc<T, R>
where T: Send,

§

impl<T, const R: usize> Sync for CustomVc<T, R>
where T: Sync,

§

impl<T, const R: usize> Unpin for CustomVc<T, R>
where T: Unpin,

§

impl<T, const R: usize> UnwindSafe for CustomVc<T, R>
where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<'data, I> IntoParallelRefIterator<'data> for I
where I: 'data + ?Sized, &'data I: IntoParallelIterator,

§

type Iter = <&'data I as IntoParallelIterator>::Iter

The type of the parallel iterator that will be returned.
§

type Item = <&'data I as IntoParallelIterator>::Item

The type of item that the parallel iterator will produce. This will typically be an &'data T reference type.
source§

fn par_iter(&'data self) -> <I as IntoParallelRefIterator<'data>>::Iter

Converts self into a parallel iterator. Read more
source§

impl<'data, I> IntoParallelRefMutIterator<'data> for I

§

type Iter = <&'data mut I as IntoParallelIterator>::Iter

The type of iterator that will be created.
§

type Item = <&'data mut I as IntoParallelIterator>::Item

The type of item that will be produced; this is typically an &'data mut T reference.
source§

fn par_iter_mut( &'data mut self ) -> <I as IntoParallelRefMutIterator<'data>>::Iter

Creates the parallel iterator from self. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,