Expand description
A double-ended queue implemented with a growable ring buffer.
The “default” usage of this type as a queue is to use push_back to add to
the queue, and pop_front to remove from the queue. extend and append
push onto the back in this manner, and iterating over VecDeque goes front
to back.
A VecDeque with a known list of items can be initialized from an array:
use std::collections::VecDeque;
let deq = VecDeque::from([-1, 0, 1]);Since VecDeque is a ring buffer, its elements are not necessarily contiguous
in memory. If you want to access the elements as a single slice, such as for
efficient sorting, you can use make_contiguous. It rotates the VecDeque
so that its elements do not wrap, and returns a mutable slice to the
now-contiguous element sequence.
Implementations
sourceimpl<T> VecDeque<T, Global>
impl<T> VecDeque<T, Global>
sourcepub fn new() -> VecDeque<T, Global>ⓘNotable traits for VecDeque<u8, A>impl<A> Write for VecDeque<u8, A> where
A: Allocator, impl<A> Read for VecDeque<u8, A> where
A: Allocator,
pub fn new() -> VecDeque<T, Global>ⓘNotable traits for VecDeque<u8, A>impl<A> Write for VecDeque<u8, A> where
A: Allocator, impl<A> Read for VecDeque<u8, A> where
A: Allocator,
A: Allocator, impl<A> Read for VecDeque<u8, A> where
A: Allocator,
Creates an empty deque.
Examples
use std::collections::VecDeque;
let deque: VecDeque<u32> = VecDeque::new();sourcepub fn with_capacity(capacity: usize) -> VecDeque<T, Global>ⓘNotable traits for VecDeque<u8, A>impl<A> Write for VecDeque<u8, A> where
A: Allocator, impl<A> Read for VecDeque<u8, A> where
A: Allocator,
pub fn with_capacity(capacity: usize) -> VecDeque<T, Global>ⓘNotable traits for VecDeque<u8, A>impl<A> Write for VecDeque<u8, A> where
A: Allocator, impl<A> Read for VecDeque<u8, A> where
A: Allocator,
A: Allocator, impl<A> Read for VecDeque<u8, A> where
A: Allocator,
Creates an empty deque with space for at least capacity elements.
Examples
use std::collections::VecDeque;
let deque: VecDeque<u32> = VecDeque::with_capacity(10);sourceimpl<T, A> VecDeque<T, A> where
A: Allocator,
impl<T, A> VecDeque<T, A> where
A: Allocator,
sourcepub fn new_in(alloc: A) -> VecDeque<T, A>ⓘNotable traits for VecDeque<u8, A>impl<A> Write for VecDeque<u8, A> where
A: Allocator, impl<A> Read for VecDeque<u8, A> where
A: Allocator,
🔬 This is a nightly-only experimental API. (allocator_api)
pub fn new_in(alloc: A) -> VecDeque<T, A>ⓘNotable traits for VecDeque<u8, A>impl<A> Write for VecDeque<u8, A> where
A: Allocator, impl<A> Read for VecDeque<u8, A> where
A: Allocator,
A: Allocator, impl<A> Read for VecDeque<u8, A> where
A: Allocator,
allocator_api)Creates an empty deque.
Examples
use std::collections::VecDeque;
let deque: VecDeque<u32> = VecDeque::new();sourcepub fn with_capacity_in(capacity: usize, alloc: A) -> VecDeque<T, A>ⓘNotable traits for VecDeque<u8, A>impl<A> Write for VecDeque<u8, A> where
A: Allocator, impl<A> Read for VecDeque<u8, A> where
A: Allocator,
🔬 This is a nightly-only experimental API. (allocator_api)
pub fn with_capacity_in(capacity: usize, alloc: A) -> VecDeque<T, A>ⓘNotable traits for VecDeque<u8, A>impl<A> Write for VecDeque<u8, A> where
A: Allocator, impl<A> Read for VecDeque<u8, A> where
A: Allocator,
A: Allocator, impl<A> Read for VecDeque<u8, A> where
A: Allocator,
allocator_api)Creates an empty deque with space for at least capacity elements.
Examples
use std::collections::VecDeque;
let deque: VecDeque<u32> = VecDeque::with_capacity(10);sourcepub fn get(&self, index: usize) -> Option<&T>
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 std::collections::VecDeque;
let mut buf = VecDeque::new();
buf.push_back(3);
buf.push_back(4);
buf.push_back(5);
assert_eq!(buf.get(1), Some(&4));sourcepub fn get_mut(&mut self, index: usize) -> Option<&mut T>
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 std::collections::VecDeque;
let mut buf = VecDeque::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);sourcepub fn swap(&mut self, i: usize, j: usize)
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 std::collections::VecDeque;
let mut buf = VecDeque::new();
buf.push_back(3);
buf.push_back(4);
buf.push_back(5);
assert_eq!(buf, [3, 4, 5]);
buf.swap(0, 2);
assert_eq!(buf, [5, 4, 3]);sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Returns the number of elements the deque can hold without reallocating.
Examples
use std::collections::VecDeque;
let buf: VecDeque<i32> = VecDeque::with_capacity(10);
assert!(buf.capacity() >= 10);sourcepub fn reserve_exact(&mut self, additional: usize)
pub fn reserve_exact(&mut self, additional: usize)
Reserves the minimum capacity for at least additional more elements to be inserted in the
given deque. 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.
Panics
Panics if the new capacity overflows usize.
Examples
use std::collections::VecDeque;
let mut buf: VecDeque<i32> = [1].into();
buf.reserve_exact(10);
assert!(buf.capacity() >= 11);sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserves capacity for at least additional more elements to be inserted in the given
deque. The collection may reserve more space to speculatively avoid frequent reallocations.
Panics
Panics if the new capacity overflows usize.
Examples
use std::collections::VecDeque;
let mut buf: VecDeque<i32> = [1].into();
buf.reserve(10);
assert!(buf.capacity() >= 11);1.57.0 · sourcepub fn try_reserve_exact(
&mut self,
additional: usize
) -> Result<(), TryReserveError>
pub fn try_reserve_exact(
&mut self,
additional: usize
) -> Result<(), TryReserveError>
Tries to reserve the minimum capacity for at least additional more elements to
be inserted in the given deque. After calling try_reserve_exact,
capacity will be greater than or equal to self.len() + additional if
it returns Ok(()). 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 try_reserve if future insertions are expected.
Errors
If the capacity overflows usize, or the allocator reports a failure, then an error
is returned.
Examples
use std::collections::TryReserveError;
use std::collections::VecDeque;
fn process_data(data: &[u32]) -> Result<VecDeque<u32>, TryReserveError> {
let mut output = VecDeque::new();
// Pre-reserve the memory, exiting if we can't
output.try_reserve_exact(data.len())?;
// Now we know this can't OOM(Out-Of-Memory) in the middle of our complex work
output.extend(data.iter().map(|&val| {
val * 2 + 5 // very complicated
}));
Ok(output)
}1.57.0 · sourcepub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError>
pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError>
Tries to reserve capacity for at least additional more elements to be inserted
in the given deque. The collection may reserve more space to speculatively avoid
frequent reallocations. After calling try_reserve, capacity will be
greater than or equal to self.len() + additional if it returns
Ok(()). Does nothing if capacity is already sufficient.
Errors
If the capacity overflows usize, or the allocator reports a failure, then an error
is returned.
Examples
use std::collections::TryReserveError;
use std::collections::VecDeque;
fn process_data(data: &[u32]) -> Result<VecDeque<u32>, TryReserveError> {
let mut output = VecDeque::new();
// Pre-reserve the memory, exiting if we can't
output.try_reserve(data.len())?;
// Now we know this can't OOM in the middle of our complex work
output.extend(data.iter().map(|&val| {
val * 2 + 5 // very complicated
}));
Ok(output)
}1.5.0 · sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Shrinks the capacity of the deque as much as possible.
It will drop down as close as possible to the length but the allocator may still inform the deque that there is space for a few more elements.
Examples
use std::collections::VecDeque;
let mut buf = VecDeque::with_capacity(15);
buf.extend(0..4);
assert_eq!(buf.capacity(), 15);
buf.shrink_to_fit();
assert!(buf.capacity() >= 4);1.56.0 · sourcepub fn shrink_to(&mut self, min_capacity: usize)
pub fn shrink_to(&mut self, min_capacity: usize)
Shrinks the capacity of the deque with a lower bound.
The capacity will remain at least as large as both the length and the supplied value.
If the current capacity is less than the lower limit, this is a no-op.
Examples
use std::collections::VecDeque;
let mut buf = VecDeque::with_capacity(15);
buf.extend(0..4);
assert_eq!(buf.capacity(), 15);
buf.shrink_to(6);
assert!(buf.capacity() >= 6);
buf.shrink_to(0);
assert!(buf.capacity() >= 4);1.16.0 · sourcepub fn truncate(&mut self, len: usize)
pub fn truncate(&mut self, len: usize)
Shortens the deque, keeping the first len elements and dropping
the rest.
If len is greater than the deque’s current length, this has no
effect.
Examples
use std::collections::VecDeque;
let mut buf = VecDeque::new();
buf.push_back(5);
buf.push_back(10);
buf.push_back(15);
assert_eq!(buf, [5, 10, 15]);
buf.truncate(1);
assert_eq!(buf, [5]);sourcepub fn allocator(&self) -> &A
🔬 This is a nightly-only experimental API. (allocator_api)
pub fn allocator(&self) -> &A
allocator_api)Returns a reference to the underlying allocator.
sourcepub fn iter(&self) -> Iter<'_, T>
pub fn iter(&self) -> Iter<'_, T>
Returns a front-to-back iterator.
Examples
use std::collections::VecDeque;
let mut buf = VecDeque::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);sourcepub fn iter_mut(&mut self) -> IterMut<'_, T>
pub fn iter_mut(&mut self) -> IterMut<'_, T>
Returns a front-to-back iterator that returns mutable references.
Examples
use std::collections::VecDeque;
let mut buf = VecDeque::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);1.5.0 · sourcepub fn as_slices(&self) -> (&[T], &[T])
pub fn as_slices(&self) -> (&[T], &[T])
Returns a pair of slices which contain, in order, the contents of the deque.
If make_contiguous was previously called, all elements of the
deque will be in the first slice and the second slice will be empty.
Examples
use std::collections::VecDeque;
let mut deque = VecDeque::new();
deque.push_back(0);
deque.push_back(1);
deque.push_back(2);
assert_eq!(deque.as_slices(), (&[0, 1, 2][..], &[][..]));
deque.push_front(10);
deque.push_front(9);
assert_eq!(deque.as_slices(), (&[9, 10][..], &[0, 1, 2][..]));1.5.0 · sourcepub fn as_mut_slices(&mut self) -> (&mut [T], &mut [T])
pub fn as_mut_slices(&mut self) -> (&mut [T], &mut [T])
Returns a pair of slices which contain, in order, the contents of the deque.
If make_contiguous was previously called, all elements of the
deque will be in the first slice and the second slice will be empty.
Examples
use std::collections::VecDeque;
let mut deque = VecDeque::new();
deque.push_back(0);
deque.push_back(1);
deque.push_front(10);
deque.push_front(9);
deque.as_mut_slices().0[0] = 42;
deque.as_mut_slices().1[0] = 24;
assert_eq!(deque.as_slices(), (&[42, 10][..], &[24, 1][..]));sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of elements in the deque.
Examples
use std::collections::VecDeque;
let mut deque = VecDeque::new();
assert_eq!(deque.len(), 0);
deque.push_back(1);
assert_eq!(deque.len(), 1);sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if the deque is empty.
Examples
use std::collections::VecDeque;
let mut deque = VecDeque::new();
assert!(deque.is_empty());
deque.push_front(1);
assert!(!deque.is_empty());1.51.0 · sourcepub fn range<R>(&self, range: R) -> Iter<'_, T> where
R: RangeBounds<usize>,
pub fn range<R>(&self, range: R) -> Iter<'_, T> where
R: RangeBounds<usize>,
Creates an iterator that covers the specified range in the deque.
Panics
Panics if the starting point is greater than the end point or if the end point is greater than the length of the deque.
Examples
use std::collections::VecDeque;
let deque: VecDeque<_> = [1, 2, 3].into();
let range = deque.range(2..).copied().collect::<VecDeque<_>>();
assert_eq!(range, [3]);
// A full range covers all contents
let all = deque.range(..);
assert_eq!(all.len(), 3);1.51.0 · sourcepub fn range_mut<R>(&mut self, range: R) -> IterMut<'_, T> where
R: RangeBounds<usize>,
pub fn range_mut<R>(&mut self, range: R) -> IterMut<'_, T> where
R: RangeBounds<usize>,
Creates an iterator that covers the specified mutable range in the deque.
Panics
Panics if the starting point is greater than the end point or if the end point is greater than the length of the deque.
Examples
use std::collections::VecDeque;
let mut deque: VecDeque<_> = [1, 2, 3].into();
for v in deque.range_mut(2..) {
*v *= 2;
}
assert_eq!(deque, [1, 2, 6]);
// A full range covers all contents
for v in deque.range_mut(..) {
*v *= 2;
}
assert_eq!(deque, [2, 4, 12]);1.6.0 · sourcepub fn drain<R>(&mut self, range: R) -> Drain<'_, T, A> where
R: RangeBounds<usize>,
pub fn drain<R>(&mut self, range: R) -> Drain<'_, T, A> where
R: RangeBounds<usize>,
Removes the specified range from the deque in bulk, returning all removed elements as an iterator. If the iterator is dropped before being fully consumed, it drops the remaining removed elements.
The returned iterator keeps a mutable borrow on the queue to optimize its implementation.
Panics
Panics if the starting point is greater than the end point or if the end point is greater than the length of the deque.
Leaking
If the returned iterator goes out of scope without being dropped (due to
mem::forget, for example), the deque may have lost and leaked
elements arbitrarily, including elements outside the range.
Examples
use std::collections::VecDeque;
let mut deque: VecDeque<_> = [1, 2, 3].into();
let drained = deque.drain(2..).collect::<VecDeque<_>>();
assert_eq!(drained, [3]);
assert_eq!(deque, [1, 2]);
// A full range clears all contents, like `clear()` does
deque.drain(..);
assert!(deque.is_empty());sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clears the deque, removing all values.
Examples
use std::collections::VecDeque;
let mut deque = VecDeque::new();
deque.push_back(1);
deque.clear();
assert!(deque.is_empty());1.12.0 · sourcepub fn contains(&self, x: &T) -> bool where
T: PartialEq<T>,
pub fn contains(&self, x: &T) -> bool where
T: PartialEq<T>,
Returns true if the deque contains an element equal to the
given value.
This operation is O(n).
Note that if you have a sorted VecDeque, binary_search may be faster.
Examples
use std::collections::VecDeque;
let mut deque: VecDeque<u32> = VecDeque::new();
deque.push_back(0);
deque.push_back(1);
assert_eq!(deque.contains(&1), true);
assert_eq!(deque.contains(&10), false);sourcepub fn front(&self) -> Option<&T>
pub fn front(&self) -> Option<&T>
Provides a reference to the front element, or None if the deque is
empty.
Examples
use std::collections::VecDeque;
let mut d = VecDeque::new();
assert_eq!(d.front(), None);
d.push_back(1);
d.push_back(2);
assert_eq!(d.front(), Some(&1));sourcepub fn front_mut(&mut self) -> Option<&mut T>
pub fn front_mut(&mut self) -> Option<&mut T>
Provides a mutable reference to the front element, or None if the
deque is empty.
Examples
use std::collections::VecDeque;
let mut d = VecDeque::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));sourcepub fn back(&self) -> Option<&T>
pub fn back(&self) -> Option<&T>
Provides a reference to the back element, or None if the deque is
empty.
Examples
use std::collections::VecDeque;
let mut d = VecDeque::new();
assert_eq!(d.back(), None);
d.push_back(1);
d.push_back(2);
assert_eq!(d.back(), Some(&2));sourcepub fn back_mut(&mut self) -> Option<&mut T>
pub fn back_mut(&mut self) -> Option<&mut T>
Provides a mutable reference to the back element, or None if the
deque is empty.
Examples
use std::collections::VecDeque;
let mut d = VecDeque::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));sourcepub fn pop_front(&mut self) -> Option<T>
pub fn pop_front(&mut self) -> Option<T>
Removes the first element and returns it, or None if the deque is
empty.
Examples
use std::collections::VecDeque;
let mut d = VecDeque::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);sourcepub fn pop_back(&mut self) -> Option<T>
pub fn pop_back(&mut self) -> Option<T>
Removes the last element from the deque and returns it, or None if
it is empty.
Examples
use std::collections::VecDeque;
let mut buf = VecDeque::new();
assert_eq!(buf.pop_back(), None);
buf.push_back(1);
buf.push_back(3);
assert_eq!(buf.pop_back(), Some(3));sourcepub fn push_front(&mut self, value: T)
pub fn push_front(&mut self, value: T)
Prepends an element to the deque.
Examples
use std::collections::VecDeque;
let mut d = VecDeque::new();
d.push_front(1);
d.push_front(2);
assert_eq!(d.front(), Some(&2));sourcepub fn push_back(&mut self, value: T)
pub fn push_back(&mut self, value: T)
Appends an element to the back of the deque.
Examples
use std::collections::VecDeque;
let mut buf = VecDeque::new();
buf.push_back(1);
buf.push_back(3);
assert_eq!(3, *buf.back().unwrap());1.5.0 · sourcepub fn swap_remove_front(&mut self, index: usize) -> Option<T>
pub fn swap_remove_front(&mut self, index: usize) -> Option<T>
Removes an element from anywhere in the deque 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 std::collections::VecDeque;
let mut buf = VecDeque::new();
assert_eq!(buf.swap_remove_front(0), None);
buf.push_back(1);
buf.push_back(2);
buf.push_back(3);
assert_eq!(buf, [1, 2, 3]);
assert_eq!(buf.swap_remove_front(2), Some(3));
assert_eq!(buf, [2, 1]);1.5.0 · sourcepub fn swap_remove_back(&mut self, index: usize) -> Option<T>
pub fn swap_remove_back(&mut self, index: usize) -> Option<T>
Removes an element from anywhere in the deque 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 std::collections::VecDeque;
let mut buf = VecDeque::new();
assert_eq!(buf.swap_remove_back(0), None);
buf.push_back(1);
buf.push_back(2);
buf.push_back(3);
assert_eq!(buf, [1, 2, 3]);
assert_eq!(buf.swap_remove_back(0), Some(1));
assert_eq!(buf, [3, 2]);1.5.0 · sourcepub fn insert(&mut self, index: usize, value: T)
pub fn insert(&mut self, index: usize, value: T)
Inserts an element at index within the deque, 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 deque’s length
Examples
use std::collections::VecDeque;
let mut vec_deque = VecDeque::new();
vec_deque.push_back('a');
vec_deque.push_back('b');
vec_deque.push_back('c');
assert_eq!(vec_deque, &['a', 'b', 'c']);
vec_deque.insert(1, 'd');
assert_eq!(vec_deque, &['a', 'd', 'b', 'c']);sourcepub fn remove(&mut self, index: usize) -> Option<T>
pub fn remove(&mut self, index: usize) -> Option<T>
Removes and returns the element at index from the deque.
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.
Returns None if index is out of bounds.
Element at index 0 is the front of the queue.
Examples
use std::collections::VecDeque;
let mut buf = VecDeque::new();
buf.push_back(1);
buf.push_back(2);
buf.push_back(3);
assert_eq!(buf, [1, 2, 3]);
assert_eq!(buf.remove(1), Some(2));
assert_eq!(buf, [1, 3]);1.4.0 · sourcepub fn split_off(&mut self, at: usize) -> VecDeque<T, A>ⓘNotable traits for VecDeque<u8, A>impl<A> Write for VecDeque<u8, A> where
A: Allocator, impl<A> Read for VecDeque<u8, A> where
A: Allocator, where
A: Clone,
pub fn split_off(&mut self, at: usize) -> VecDeque<T, A>ⓘNotable traits for VecDeque<u8, A>impl<A> Write for VecDeque<u8, A> where
A: Allocator, impl<A> Read for VecDeque<u8, A> where
A: Allocator, where
A: Clone,
A: Allocator, impl<A> Read for VecDeque<u8, A> where
A: Allocator,
Splits the deque into two at the given index.
Returns a newly allocated VecDeque. self contains elements [0, at),
and the returned deque 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 std::collections::VecDeque;
let mut buf: VecDeque<_> = [1, 2, 3].into();
let buf2 = buf.split_off(1);
assert_eq!(buf, [1]);
assert_eq!(buf2, [2, 3]);1.4.0 · sourcepub fn append(&mut self, other: &mut VecDeque<T, A>)
pub fn append(&mut self, other: &mut VecDeque<T, A>)
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 std::collections::VecDeque;
let mut buf: VecDeque<_> = [1, 2].into();
let mut buf2: VecDeque<_> = [3, 4].into();
buf.append(&mut buf2);
assert_eq!(buf, [1, 2, 3, 4]);
assert_eq!(buf2, []);1.4.0 · sourcepub fn retain<F>(&mut self, f: F) where
F: for<'_> FnMut(&T) -> bool,
pub fn retain<F>(&mut self, f: F) where
F: for<'_> FnMut(&T) -> bool,
Retains only the elements specified by the predicate.
In other words, remove all elements e for which 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 std::collections::VecDeque;
let mut buf = VecDeque::new();
buf.extend(1..5);
buf.retain(|&x| x % 2 == 0);
assert_eq!(buf, [2, 4]);Because the elements are visited exactly once in the original order, external state may be used to decide which elements to keep.
use std::collections::VecDeque;
let mut buf = VecDeque::new();
buf.extend(1..6);
let keep = [false, true, true, false, true];
let mut iter = keep.iter();
buf.retain(|_| *iter.next().unwrap());
assert_eq!(buf, [2, 3, 5]);1.61.0 · sourcepub fn retain_mut<F>(&mut self, f: F) where
F: for<'_> FnMut(&mut T) -> bool,
pub fn retain_mut<F>(&mut self, f: F) where
F: for<'_> FnMut(&mut T) -> bool,
Retains only the elements specified by the predicate.
In other words, remove all elements e for which 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 std::collections::VecDeque;
let mut buf = VecDeque::new();
buf.extend(1..5);
buf.retain_mut(|x| if *x % 2 == 0 {
*x += 1;
true
} else {
false
});
assert_eq!(buf, [3, 5]);1.33.0 · sourcepub fn resize_with(&mut self, new_len: usize, generator: impl FnMut() -> T)
pub fn resize_with(&mut self, new_len: usize, generator: impl FnMut() -> T)
Modifies the deque 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 std::collections::VecDeque;
let mut buf = VecDeque::new();
buf.push_back(5);
buf.push_back(10);
buf.push_back(15);
assert_eq!(buf, [5, 10, 15]);
buf.resize_with(5, Default::default);
assert_eq!(buf, [5, 10, 15, 0, 0]);
buf.resize_with(2, || unreachable!());
assert_eq!(buf, [5, 10]);
let mut state = 100;
buf.resize_with(5, || { state += 1; state });
assert_eq!(buf, [5, 10, 101, 102, 103]);1.48.0 · sourcepub fn make_contiguous(&mut self) -> &mut [T]ⓘNotable traits for &mut [u8]impl<'_> Write for &mut [u8]impl<'_> Read for &[u8]
pub fn make_contiguous(&mut self) -> &mut [T]ⓘNotable traits for &mut [u8]impl<'_> Write for &mut [u8]impl<'_> Read for &[u8]
Rearranges the internal storage of this deque so it is 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 a deque.
Once the internal storage is contiguous, the as_slices and
as_mut_slices methods will return the entire contents of the
deque in a single slice.
Examples
Sorting the content of a deque.
use std::collections::VecDeque;
let mut buf = VecDeque::with_capacity(15);
buf.push_back(2);
buf.push_back(1);
buf.push_front(3);
// sorting the deque
buf.make_contiguous().sort();
assert_eq!(buf.as_slices(), (&[1, 2, 3] as &[_], &[] as &[_]));
// sorting it in reverse order
buf.make_contiguous().sort_by(|a, b| b.cmp(a));
assert_eq!(buf.as_slices(), (&[3, 2, 1] as &[_], &[] as &[_]));Getting immutable access to the contiguous slice.
use std::collections::VecDeque;
let mut buf = VecDeque::new();
buf.push_back(2);
buf.push_back(1);
buf.push_front(3);
buf.make_contiguous();
if let (slice, &[]) = buf.as_slices() {
// 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, &[3, 2, 1] as &[_]);
}1.36.0 · sourcepub fn rotate_left(&mut self, mid: usize)
pub fn rotate_left(&mut self, mid: usize)
Rotates the double-ended queue mid places to the left.
Equivalently,
- Rotates item
midinto the first position. - Pops the first
miditems and pushes them to the end. - Rotates
len() - midplaces to the right.
Panics
If mid is greater than len(). Note that mid == len()
does not panic and is a no-op rotation.
Complexity
Takes *O*(min(mid, len() - mid)) time and no extra space.
Examples
use std::collections::VecDeque;
let mut buf: VecDeque<_> = (0..10).collect();
buf.rotate_left(3);
assert_eq!(buf, [3, 4, 5, 6, 7, 8, 9, 0, 1, 2]);
for i in 1..10 {
assert_eq!(i * 3 % 10, buf[0]);
buf.rotate_left(3);
}
assert_eq!(buf, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);1.36.0 · sourcepub fn rotate_right(&mut self, k: usize)
pub fn rotate_right(&mut self, k: usize)
Rotates the double-ended queue k places to the right.
Equivalently,
- Rotates the first item into position
k. - Pops the last
kitems and pushes them to the front. - Rotates
len() - kplaces to the left.
Panics
If k is greater than len(). Note that k == len()
does not panic and is a no-op rotation.
Complexity
Takes *O*(min(k, len() - k)) time and no extra space.
Examples
use std::collections::VecDeque;
let mut buf: VecDeque<_> = (0..10).collect();
buf.rotate_right(3);
assert_eq!(buf, [7, 8, 9, 0, 1, 2, 3, 4, 5, 6]);
for i in 1..10 {
assert_eq!(0, buf[i * 3 % 10]);
buf.rotate_right(3);
}
assert_eq!(buf, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);1.54.0 · sourcepub fn binary_search(&self, x: &T) -> Result<usize, usize> where
T: Ord,
pub fn binary_search(&self, x: &T) -> Result<usize, usize> where
T: Ord,
Binary searches this VecDeque for a given element.
This behaves similarly to contains if this VecDeque is sorted.
If the value is found then Result::Ok is returned, containing the
index of the matching element. If there are multiple matches, then any
one of the matches could be returned. If the value is not found then
Result::Err is returned, containing the index where a matching
element could be inserted while maintaining sorted order.
See also binary_search_by, binary_search_by_key, and partition_point.
Examples
Looks up a series of four elements. The first is found, with a
uniquely determined position; the second and third are not
found; the fourth could match any position in [1, 4].
use std::collections::VecDeque;
let deque: VecDeque<_> = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55].into();
assert_eq!(deque.binary_search(&13), Ok(9));
assert_eq!(deque.binary_search(&4), Err(7));
assert_eq!(deque.binary_search(&100), Err(13));
let r = deque.binary_search(&1);
assert!(matches!(r, Ok(1..=4)));If you want to insert an item to a sorted deque, while maintaining
sort order, consider using partition_point:
use std::collections::VecDeque;
let mut deque: VecDeque<_> = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55].into();
let num = 42;
let idx = deque.partition_point(|&x| x < num);
// The above is equivalent to `let idx = deque.binary_search(&num).unwrap_or_else(|x| x);`
deque.insert(idx, num);
assert_eq!(deque, &[0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 42, 55]);1.54.0 · sourcepub fn binary_search_by<'a, F>(&'a self, f: F) -> Result<usize, usize> where
F: FnMut(&'a T) -> Ordering,
pub fn binary_search_by<'a, F>(&'a self, f: F) -> Result<usize, usize> where
F: FnMut(&'a T) -> Ordering,
Binary searches this VecDeque with a comparator function.
This behaves similarly to contains if this VecDeque is sorted.
The comparator function should implement an order consistent
with the sort order of the deque, returning an order code that
indicates whether its argument is Less, Equal or Greater
than the desired target.
If the value is found then Result::Ok is returned, containing the
index of the matching element. If there are multiple matches, then any
one of the matches could be returned. If the value is not found then
Result::Err is returned, containing the index where a matching
element could be inserted while maintaining sorted order.
See also binary_search, binary_search_by_key, and partition_point.
Examples
Looks up a series of four elements. The first is found, with a
uniquely determined position; the second and third are not
found; the fourth could match any position in [1, 4].
use std::collections::VecDeque;
let deque: VecDeque<_> = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55].into();
assert_eq!(deque.binary_search_by(|x| x.cmp(&13)), Ok(9));
assert_eq!(deque.binary_search_by(|x| x.cmp(&4)), Err(7));
assert_eq!(deque.binary_search_by(|x| x.cmp(&100)), Err(13));
let r = deque.binary_search_by(|x| x.cmp(&1));
assert!(matches!(r, Ok(1..=4)));1.54.0 · sourcepub fn binary_search_by_key<'a, B, F>(
&'a self,
b: &B,
f: F
) -> Result<usize, usize> where
F: FnMut(&'a T) -> B,
B: Ord,
pub fn binary_search_by_key<'a, B, F>(
&'a self,
b: &B,
f: F
) -> Result<usize, usize> where
F: FnMut(&'a T) -> B,
B: Ord,
Binary searches this VecDeque with a key extraction function.
This behaves similarly to contains if this VecDeque is sorted.
Assumes that the deque is sorted by the key, for instance with
make_contiguous().sort_by_key() using the same key extraction function.
If the value is found then Result::Ok is returned, containing the
index of the matching element. If there are multiple matches, then any
one of the matches could be returned. If the value is not found then
Result::Err is returned, containing the index where a matching
element could be inserted while maintaining sorted order.
See also binary_search, binary_search_by, and partition_point.
Examples
Looks up a series of four elements in a slice of pairs sorted by
their second elements. The first is found, with a uniquely
determined position; the second and third are not found; the
fourth could match any position in [1, 4].
use std::collections::VecDeque;
let deque: VecDeque<_> = [(0, 0), (2, 1), (4, 1), (5, 1),
(3, 1), (1, 2), (2, 3), (4, 5), (5, 8), (3, 13),
(1, 21), (2, 34), (4, 55)].into();
assert_eq!(deque.binary_search_by_key(&13, |&(a, b)| b), Ok(9));
assert_eq!(deque.binary_search_by_key(&4, |&(a, b)| b), Err(7));
assert_eq!(deque.binary_search_by_key(&100, |&(a, b)| b), Err(13));
let r = deque.binary_search_by_key(&1, |&(a, b)| b);
assert!(matches!(r, Ok(1..=4)));1.54.0 · sourcepub fn partition_point<P>(&self, pred: P) -> usize where
P: for<'_> FnMut(&T) -> bool,
pub fn partition_point<P>(&self, pred: P) -> usize where
P: for<'_> FnMut(&T) -> bool,
Returns the index of the partition point according to the given predicate (the index of the first element of the second partition).
The deque is assumed to be partitioned according to the given predicate. This means that all elements for which the predicate returns true are at the start of the deque and all elements for which the predicate returns false are at the end. For example, [7, 15, 3, 5, 4, 12, 6] is a partitioned under the predicate x % 2 != 0 (all odd numbers are at the start, all even at the end).
If the deque is not partitioned, the returned result is unspecified and meaningless, as this method performs a kind of binary search.
See also binary_search, binary_search_by, and binary_search_by_key.
Examples
use std::collections::VecDeque;
let deque: VecDeque<_> = [1, 2, 3, 3, 5, 6, 7].into();
let i = deque.partition_point(|&x| x < 5);
assert_eq!(i, 4);
assert!(deque.iter().take(i).all(|&x| x < 5));
assert!(deque.iter().skip(i).all(|&x| !(x < 5)));If you want to insert an item to a sorted deque, while maintaining sort order:
use std::collections::VecDeque;
let mut deque: VecDeque<_> = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55].into();
let num = 42;
let idx = deque.partition_point(|&x| x < num);
deque.insert(idx, num);
assert_eq!(deque, &[0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 42, 55]);sourceimpl<T, A> VecDeque<T, A> where
T: Clone,
A: Allocator,
impl<T, A> VecDeque<T, A> where
T: Clone,
A: Allocator,
1.16.0 · sourcepub fn resize(&mut self, new_len: usize, value: T)
pub fn resize(&mut self, new_len: usize, value: T)
Modifies the deque 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 std::collections::VecDeque;
let mut buf = VecDeque::new();
buf.push_back(5);
buf.push_back(10);
buf.push_back(15);
assert_eq!(buf, [5, 10, 15]);
buf.resize(2, 0);
assert_eq!(buf, [5, 10]);
buf.resize(5, 20);
assert_eq!(buf, [5, 10, 20, 20, 20]);Trait Implementations
sourceimpl<T, A> Clone for VecDeque<T, A> where
T: Clone,
A: Allocator + Clone,
impl<T, A> Clone for VecDeque<T, A> where
T: Clone,
A: Allocator + Clone,
sourcefn clone(&self) -> VecDeque<T, A>ⓘNotable traits for VecDeque<u8, A>impl<A> Write for VecDeque<u8, A> where
A: Allocator, impl<A> Read for VecDeque<u8, A> where
A: Allocator,
fn clone(&self) -> VecDeque<T, A>ⓘNotable traits for VecDeque<u8, A>impl<A> Write for VecDeque<u8, A> where
A: Allocator, impl<A> Read for VecDeque<u8, A> where
A: Allocator,
A: Allocator, impl<A> Read for VecDeque<u8, A> where
A: Allocator,
Returns a copy of the value. Read more
sourcefn clone_from(&mut self, other: &VecDeque<T, A>)
fn clone_from(&mut self, other: &VecDeque<T, A>)
Performs copy-assignment from source. Read more
1.2.0 · sourceimpl<'a, T, A> Extend<&'a T> for VecDeque<T, A> where
T: 'a + Copy,
A: Allocator,
impl<'a, T, A> Extend<&'a T> for VecDeque<T, A> where
T: 'a + Copy,
A: Allocator,
sourcefn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = &'a T>,
fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = &'a T>,
Extends a collection with the contents of an iterator. Read more
sourcefn extend_one(&mut self, &T)
fn extend_one(&mut self, &T)
extend_one)Extends a collection with exactly one element.
sourcefn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
sourceimpl<T, A> Extend<T> for VecDeque<T, A> where
A: Allocator,
impl<T, A> Extend<T> for VecDeque<T, A> where
A: Allocator,
sourcefn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = T>,
fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = T>,
Extends a collection with the contents of an iterator. Read more
sourcefn extend_one(&mut self, elem: T)
fn extend_one(&mut self, elem: T)
extend_one)Extends a collection with exactly one element.
sourcefn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
1.56.0 · sourceimpl<T, const N: usize> From<[T; N]> for VecDeque<T, Global>
impl<T, const N: usize> From<[T; N]> for VecDeque<T, Global>
sourcefn from(arr: [T; N]) -> VecDeque<T, Global>ⓘNotable traits for VecDeque<u8, A>impl<A> Write for VecDeque<u8, A> where
A: Allocator, impl<A> Read for VecDeque<u8, A> where
A: Allocator,
fn from(arr: [T; N]) -> VecDeque<T, Global>ⓘNotable traits for VecDeque<u8, A>impl<A> Write for VecDeque<u8, A> where
A: Allocator, impl<A> Read for VecDeque<u8, A> where
A: Allocator,
A: Allocator, impl<A> Read for VecDeque<u8, A> where
A: Allocator,
Converts a [T; N] into a VecDeque<T>.
use std::collections::VecDeque;
let deq1 = VecDeque::from([1, 2, 3, 4]);
let deq2: VecDeque<_> = [1, 2, 3, 4].into();
assert_eq!(deq1, deq2);1.10.0 · sourceimpl<T, A> From<Vec<T, A>> for VecDeque<T, A> where
A: Allocator,
impl<T, A> From<Vec<T, A>> for VecDeque<T, A> where
A: Allocator,
sourcefn from(other: Vec<T, A>) -> VecDeque<T, A>ⓘNotable traits for VecDeque<u8, A>impl<A> Write for VecDeque<u8, A> where
A: Allocator, impl<A> Read for VecDeque<u8, A> where
A: Allocator,
fn from(other: Vec<T, A>) -> VecDeque<T, A>ⓘNotable traits for VecDeque<u8, A>impl<A> Write for VecDeque<u8, A> where
A: Allocator, impl<A> Read for VecDeque<u8, A> where
A: Allocator,
A: Allocator, impl<A> Read for VecDeque<u8, A> where
A: Allocator,
Turn a Vec<T> into a VecDeque<T>.
This avoids reallocating where possible, but the conditions for that are
strict, and subject to change, and so shouldn’t be relied upon unless the
Vec<T> came from From<VecDeque<T>> and hasn’t been reallocated.
1.10.0 · sourceimpl<T, A> From<VecDeque<T, A>> for Vec<T, A> where
A: Allocator,
impl<T, A> From<VecDeque<T, A>> for Vec<T, A> where
A: Allocator,
sourcefn from(other: VecDeque<T, A>) -> Vec<T, A>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
fn from(other: VecDeque<T, A>) -> Vec<T, A>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Turn a VecDeque<T> into a Vec<T>.
This never needs to re-allocate, but does need to do O(n) data movement if the circular buffer doesn’t happen to be at the beginning of the allocation.
Examples
use std::collections::VecDeque;
// This one is *O*(1).
let deque: VecDeque<_> = (1..5).collect();
let ptr = deque.as_slices().0.as_ptr();
let vec = Vec::from(deque);
assert_eq!(vec, [1, 2, 3, 4]);
assert_eq!(vec.as_ptr(), ptr);
// This one needs data rearranging.
let mut deque: VecDeque<_> = (1..5).collect();
deque.push_front(9);
deque.push_front(8);
let ptr = deque.as_slices().1.as_ptr();
let vec = Vec::from(deque);
assert_eq!(vec, [8, 9, 1, 2, 3, 4]);
assert_eq!(vec.as_ptr(), ptr);sourceimpl<T> FromIterator<T> for VecDeque<T, Global>
impl<T> FromIterator<T> for VecDeque<T, Global>
sourceimpl<T> FromParallelIterator<T> for VecDeque<T, Global> where
T: Send,
impl<T> FromParallelIterator<T> for VecDeque<T, Global> where
T: Send,
Collects items from a parallel iterator into a vecdeque.
sourcefn from_par_iter<I>(par_iter: I) -> VecDeque<T, Global>ⓘNotable traits for VecDeque<u8, A>impl<A> Write for VecDeque<u8, A> where
A: Allocator, impl<A> Read for VecDeque<u8, A> where
A: Allocator, where
I: IntoParallelIterator<Item = T>,
fn from_par_iter<I>(par_iter: I) -> VecDeque<T, Global>ⓘNotable traits for VecDeque<u8, A>impl<A> Write for VecDeque<u8, A> where
A: Allocator, impl<A> Read for VecDeque<u8, A> where
A: Allocator, where
I: IntoParallelIterator<Item = T>,
A: Allocator, impl<A> Read for VecDeque<u8, A> where
A: Allocator,
Creates an instance of the collection from the parallel iterator par_iter. Read more
sourceimpl<'a, T, A> IntoIterator for &'a VecDeque<T, A> where
A: Allocator,
impl<'a, T, A> IntoIterator for &'a VecDeque<T, A> where
A: Allocator,
sourceimpl<'a, T, A> IntoIterator for &'a mut VecDeque<T, A> where
A: Allocator,
impl<'a, T, A> IntoIterator for &'a mut VecDeque<T, A> where
A: Allocator,
sourceimpl<T, A> IntoIterator for VecDeque<T, A> where
A: Allocator,
impl<T, A> IntoIterator for VecDeque<T, A> where
A: Allocator,
sourceimpl<'a, T> IntoParallelIterator for &'a VecDeque<T, Global> where
T: Sync,
impl<'a, T> IntoParallelIterator for &'a VecDeque<T, Global> where
T: Sync,
sourceimpl<T> IntoParallelIterator for VecDeque<T, Global> where
T: Send,
impl<T> IntoParallelIterator for VecDeque<T, Global> where
T: Send,
type Item = T
type Item = T
The type of item that the parallel iterator will produce.
sourceimpl<'a, T> IntoParallelIterator for &'a mut VecDeque<T, Global> where
T: Send,
impl<'a, T> IntoParallelIterator for &'a mut VecDeque<T, Global> where
T: Send,
sourceimpl<T, A> Ord for VecDeque<T, A> where
T: Ord,
A: Allocator,
impl<T, A> Ord for VecDeque<T, A> where
T: Ord,
A: Allocator,
sourceimpl<'a, T> ParallelDrainRange<usize> for &'a mut VecDeque<T, Global> where
T: Send,
impl<'a, T> ParallelDrainRange<usize> for &'a mut VecDeque<T, Global> where
T: Send,
type Item = T
type Item = T
The type of item that the parallel iterator will produce.
This is usually the same as IntoParallelIterator::Item. Read more
sourcefn par_drain<R>(
self,
range: R
) -> <&'a mut VecDeque<T, Global> as ParallelDrainRange<usize>>::IterⓘNotable traits for VecDeque<u8, A>impl<A> Write for VecDeque<u8, A> where
A: Allocator, impl<A> Read for VecDeque<u8, A> where
A: Allocator, where
R: RangeBounds<usize>,
fn par_drain<R>(
self,
range: R
) -> <&'a mut VecDeque<T, Global> as ParallelDrainRange<usize>>::IterⓘNotable traits for VecDeque<u8, A>impl<A> Write for VecDeque<u8, A> where
A: Allocator, impl<A> Read for VecDeque<u8, A> where
A: Allocator, where
R: RangeBounds<usize>,
A: Allocator, impl<A> Read for VecDeque<u8, A> where
A: Allocator,
Returns a draining parallel iterator over a range of the collection. Read more
sourceimpl<'a, T> ParallelExtend<&'a T> for VecDeque<T, Global> where
T: 'a + Copy + Send + Sync,
impl<'a, T> ParallelExtend<&'a T> for VecDeque<T, Global> where
T: 'a + Copy + Send + Sync,
Extends a deque with copied items from a parallel iterator.
sourcefn par_extend<I>(&mut self, par_iter: I) where
I: IntoParallelIterator<Item = &'a T>,
fn par_extend<I>(&mut self, par_iter: I) where
I: IntoParallelIterator<Item = &'a T>,
Extends an instance of the collection with the elements drawn
from the parallel iterator par_iter. Read more
sourceimpl<T> ParallelExtend<T> for VecDeque<T, Global> where
T: Send,
impl<T> ParallelExtend<T> for VecDeque<T, Global> where
T: Send,
Extends a deque with items from a parallel iterator.
sourcefn par_extend<I>(&mut self, par_iter: I) where
I: IntoParallelIterator<Item = T>,
fn par_extend<I>(&mut self, par_iter: I) where
I: IntoParallelIterator<Item = T>,
Extends an instance of the collection with the elements drawn
from the parallel iterator par_iter. Read more
1.17.0 · sourceimpl<'_, T, U, A, const N: usize> PartialEq<&[U; N]> for VecDeque<T, A> where
A: Allocator,
T: PartialEq<U>,
impl<'_, T, U, A, const N: usize> PartialEq<&[U; N]> for VecDeque<T, A> where
A: Allocator,
T: PartialEq<U>,
1.17.0 · sourceimpl<'_, T, U, A> PartialEq<&[U]> for VecDeque<T, A> where
A: Allocator,
T: PartialEq<U>,
impl<'_, T, U, A> PartialEq<&[U]> for VecDeque<T, A> where
A: Allocator,
T: PartialEq<U>,
1.17.0 · sourceimpl<'_, T, U, A, const N: usize> PartialEq<&mut [U; N]> for VecDeque<T, A> where
A: Allocator,
T: PartialEq<U>,
impl<'_, T, U, A, const N: usize> PartialEq<&mut [U; N]> for VecDeque<T, A> where
A: Allocator,
T: PartialEq<U>,
1.17.0 · sourceimpl<'_, T, U, A> PartialEq<&mut [U]> for VecDeque<T, A> where
A: Allocator,
T: PartialEq<U>,
impl<'_, T, U, A> PartialEq<&mut [U]> for VecDeque<T, A> where
A: Allocator,
T: PartialEq<U>,
1.17.0 · sourceimpl<T, U, A, const N: usize> PartialEq<[U; N]> for VecDeque<T, A> where
A: Allocator,
T: PartialEq<U>,
impl<T, U, A, const N: usize> PartialEq<[U; N]> for VecDeque<T, A> where
A: Allocator,
T: PartialEq<U>,
1.17.0 · sourceimpl<T, U, A> PartialEq<Vec<U, A>> for VecDeque<T, A> where
A: Allocator,
T: PartialEq<U>,
impl<T, U, A> PartialEq<Vec<U, A>> for VecDeque<T, A> where
A: Allocator,
T: PartialEq<U>,
sourceimpl<T, A> PartialOrd<VecDeque<T, A>> for VecDeque<T, A> where
T: PartialOrd<T>,
A: Allocator,
impl<T, A> PartialOrd<VecDeque<T, A>> for VecDeque<T, A> where
T: PartialOrd<T>,
A: Allocator,
sourcefn partial_cmp(&self, other: &VecDeque<T, A>) -> Option<Ordering>
fn partial_cmp(&self, other: &VecDeque<T, A>) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
sourcefn le(&self, other: &Rhs) -> bool
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.63.0 · sourceimpl<A> Read for VecDeque<u8, A> where
A: Allocator,
impl<A> Read for VecDeque<u8, A> where
A: Allocator,
Read is implemented for VecDeque<u8> by consuming bytes from the front of the VecDeque.
sourcefn read(&mut self, buf: &mut [u8]) -> Result<usize, Error>
fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error>
Fill buf with the contents of the “front” slice as returned by
as_slices. If the contained byte slices of the VecDeque are
discontiguous, multiple calls to read will be needed to read the entire content.
sourcefn read_buf(&mut self, buf: &mut ReadBuf<'_>) -> Result<(), Error>
fn read_buf(&mut self, buf: &mut ReadBuf<'_>) -> Result<(), Error>
read_buf)Pull some bytes from this source into the specified buffer. Read more
1.36.0 · sourcefn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
Like read, except that it reads into a slice of buffers. Read more
sourcefn is_read_vectored(&self) -> bool
fn is_read_vectored(&self) -> bool
can_vector)Determines if this Reader has an efficient read_vectored
implementation. Read more
sourcefn read_to_end(&mut self, buf: &mut Vec<u8, Global>) -> Result<usize, Error>
fn read_to_end(&mut self, buf: &mut Vec<u8, Global>) -> Result<usize, Error>
Read all bytes until EOF in this source, placing them into buf. Read more
sourcefn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
Read all bytes until EOF in this source, appending them to buf. Read more
1.6.0 · sourcefn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
Read the exact number of bytes required to fill buf. Read more
sourcefn read_buf_exact(&mut self, buf: &mut ReadBuf<'_>) -> Result<(), Error>
fn read_buf_exact(&mut self, buf: &mut ReadBuf<'_>) -> Result<(), Error>
read_buf)Read the exact number of bytes required to fill buf. Read more
sourcefn by_ref(&mut self) -> &mut Self
fn by_ref(&mut self) -> &mut Self
Creates a “by reference” adaptor for this instance of Read. Read more
1.63.0 · sourceimpl<A> Write for VecDeque<u8, A> where
A: Allocator,
impl<A> Write for VecDeque<u8, A> where
A: Allocator,
Write is implemented for VecDeque<u8> by appending to the VecDeque, growing it as needed.
sourcefn write(&mut self, buf: &[u8]) -> Result<usize, Error>
fn write(&mut self, buf: &[u8]) -> Result<usize, Error>
Write a buffer into this writer, returning how many bytes were written. Read more
sourcefn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Attempts to write an entire buffer into this writer. Read more
sourcefn flush(&mut self) -> Result<(), Error>
fn flush(&mut self) -> Result<(), Error>
Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
sourcefn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
can_vector)Determines if this Writer has an efficient write_vectored
implementation. Read more
sourcefn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
write_all_vectored)Attempts to write multiple buffers into this writer. Read more
impl<T, A> Eq for VecDeque<T, A> where
T: Eq,
A: Allocator,
Auto Trait Implementations
impl<T, A> RefUnwindSafe for VecDeque<T, A> where
A: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, A> Send for VecDeque<T, A> where
A: Send,
T: Send,
impl<T, A> Sync for VecDeque<T, A> where
A: Sync,
T: Sync,
impl<T, A> Unpin for VecDeque<T, A> where
A: Unpin,
T: Unpin,
impl<T, A> UnwindSafe for VecDeque<T, A> where
A: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<Target, Original> Into2<Target> for Original where
Target: From2<Original>,
impl<Target, Original> Into2<Target> for Original where
Target: From2<Original>,
fn into2(self) -> Target
fn into2(self) -> Target
Performs the conversion.
sourceimpl<'data, I> IntoParallelRefIterator<'data> for I where
I: 'data + ?Sized,
&'data I: IntoParallelIterator,
impl<'data, I> IntoParallelRefIterator<'data> for I where
I: 'data + ?Sized,
&'data I: IntoParallelIterator,
type Iter = <&'data I as IntoParallelIterator>::Iter
type Iter = <&'data I as IntoParallelIterator>::Iter
The type of the parallel iterator that will be returned.
type Item = <&'data I as IntoParallelIterator>::Item
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. Read more
sourcefn par_iter(&'data self) -> <I as IntoParallelRefIterator<'data>>::Iter
fn par_iter(&'data self) -> <I as IntoParallelRefIterator<'data>>::Iter
Converts self into a parallel iterator. Read more
sourceimpl<'data, I> IntoParallelRefMutIterator<'data> for I where
I: 'data + ?Sized,
&'data mut I: IntoParallelIterator,
impl<'data, I> IntoParallelRefMutIterator<'data> for I where
I: 'data + ?Sized,
&'data mut I: IntoParallelIterator,
type Iter = <&'data mut I as IntoParallelIterator>::Iter
type Iter = <&'data mut I as IntoParallelIterator>::Iter
The type of iterator that will be created.
type Item = <&'data mut I as IntoParallelIterator>::Item
type Item = <&'data mut I as IntoParallelIterator>::Item
The type of item that will be produced; this is typically an
&'data mut T reference. Read more
sourcefn par_iter_mut(
&'data mut self
) -> <I as IntoParallelRefMutIterator<'data>>::Iter
fn par_iter_mut(
&'data mut self
) -> <I as IntoParallelRefMutIterator<'data>>::Iter
Creates the parallel iterator from self. Read more
impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = Infallible
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
impl<T> Pointable for T
impl<T> Pointable for T
impl<R> ReadBytesExt for R where
R: Read + ?Sized,
impl<R> ReadBytesExt for R where
R: Read + ?Sized,
fn read_u8(&mut self) -> Result<u8, Error>
fn read_u8(&mut self) -> Result<u8, Error>
Reads an unsigned 8 bit integer from the underlying reader. Read more
fn read_i8(&mut self) -> Result<i8, Error>
fn read_i8(&mut self) -> Result<i8, Error>
Reads a signed 8 bit integer from the underlying reader. Read more
fn read_u16<T>(&mut self) -> Result<u16, Error> where
T: ByteOrder,
fn read_u16<T>(&mut self) -> Result<u16, Error> where
T: ByteOrder,
Reads an unsigned 16 bit integer from the underlying reader. Read more
fn read_i16<T>(&mut self) -> Result<i16, Error> where
T: ByteOrder,
fn read_i16<T>(&mut self) -> Result<i16, Error> where
T: ByteOrder,
Reads a signed 16 bit integer from the underlying reader. Read more
fn read_u24<T>(&mut self) -> Result<u32, Error> where
T: ByteOrder,
fn read_u24<T>(&mut self) -> Result<u32, Error> where
T: ByteOrder,
Reads an unsigned 24 bit integer from the underlying reader. Read more
fn read_i24<T>(&mut self) -> Result<i32, Error> where
T: ByteOrder,
fn read_i24<T>(&mut self) -> Result<i32, Error> where
T: ByteOrder,
Reads a signed 24 bit integer from the underlying reader. Read more
fn read_u32<T>(&mut self) -> Result<u32, Error> where
T: ByteOrder,
fn read_u32<T>(&mut self) -> Result<u32, Error> where
T: ByteOrder,
Reads an unsigned 32 bit integer from the underlying reader. Read more
fn read_i32<T>(&mut self) -> Result<i32, Error> where
T: ByteOrder,
fn read_i32<T>(&mut self) -> Result<i32, Error> where
T: ByteOrder,
Reads a signed 32 bit integer from the underlying reader. Read more
fn read_u48<T>(&mut self) -> Result<u64, Error> where
T: ByteOrder,
fn read_u48<T>(&mut self) -> Result<u64, Error> where
T: ByteOrder,
Reads an unsigned 48 bit integer from the underlying reader. Read more
fn read_i48<T>(&mut self) -> Result<i64, Error> where
T: ByteOrder,
fn read_i48<T>(&mut self) -> Result<i64, Error> where
T: ByteOrder,
Reads a signed 48 bit integer from the underlying reader. Read more
fn read_u64<T>(&mut self) -> Result<u64, Error> where
T: ByteOrder,
fn read_u64<T>(&mut self) -> Result<u64, Error> where
T: ByteOrder,
Reads an unsigned 64 bit integer from the underlying reader. Read more
fn read_i64<T>(&mut self) -> Result<i64, Error> where
T: ByteOrder,
fn read_i64<T>(&mut self) -> Result<i64, Error> where
T: ByteOrder,
Reads a signed 64 bit integer from the underlying reader. Read more
fn read_u128<T>(&mut self) -> Result<u128, Error> where
T: ByteOrder,
fn read_u128<T>(&mut self) -> Result<u128, Error> where
T: ByteOrder,
Reads an unsigned 128 bit integer from the underlying reader. Read more
fn read_i128<T>(&mut self) -> Result<i128, Error> where
T: ByteOrder,
fn read_i128<T>(&mut self) -> Result<i128, Error> where
T: ByteOrder,
Reads a signed 128 bit integer from the underlying reader. Read more
fn read_uint<T>(&mut self, nbytes: usize) -> Result<u64, Error> where
T: ByteOrder,
fn read_uint<T>(&mut self, nbytes: usize) -> Result<u64, Error> where
T: ByteOrder,
Reads an unsigned n-bytes integer from the underlying reader. Read more
fn read_int<T>(&mut self, nbytes: usize) -> Result<i64, Error> where
T: ByteOrder,
fn read_int<T>(&mut self, nbytes: usize) -> Result<i64, Error> where
T: ByteOrder,
Reads a signed n-bytes integer from the underlying reader. Read more
fn read_uint128<T>(&mut self, nbytes: usize) -> Result<u128, Error> where
T: ByteOrder,
fn read_uint128<T>(&mut self, nbytes: usize) -> Result<u128, Error> where
T: ByteOrder,
Reads an unsigned n-bytes integer from the underlying reader.
fn read_int128<T>(&mut self, nbytes: usize) -> Result<i128, Error> where
T: ByteOrder,
fn read_int128<T>(&mut self, nbytes: usize) -> Result<i128, Error> where
T: ByteOrder,
Reads a signed n-bytes integer from the underlying reader.
fn read_f32<T>(&mut self) -> Result<f32, Error> where
T: ByteOrder,
fn read_f32<T>(&mut self) -> Result<f32, Error> where
T: ByteOrder,
Reads a IEEE754 single-precision (4 bytes) floating point number from the underlying reader. Read more
fn read_f64<T>(&mut self) -> Result<f64, Error> where
T: ByteOrder,
fn read_f64<T>(&mut self) -> Result<f64, Error> where
T: ByteOrder,
Reads a IEEE754 double-precision (8 bytes) floating point number from the underlying reader. Read more
fn read_u16_into<T>(&mut self, dst: &mut [u16]) -> Result<(), Error> where
T: ByteOrder,
fn read_u16_into<T>(&mut self, dst: &mut [u16]) -> Result<(), Error> where
T: ByteOrder,
Reads a sequence of unsigned 16 bit integers from the underlying reader. Read more
fn read_u32_into<T>(&mut self, dst: &mut [u32]) -> Result<(), Error> where
T: ByteOrder,
fn read_u32_into<T>(&mut self, dst: &mut [u32]) -> Result<(), Error> where
T: ByteOrder,
Reads a sequence of unsigned 32 bit integers from the underlying reader. Read more
fn read_u64_into<T>(&mut self, dst: &mut [u64]) -> Result<(), Error> where
T: ByteOrder,
fn read_u64_into<T>(&mut self, dst: &mut [u64]) -> Result<(), Error> where
T: ByteOrder,
Reads a sequence of unsigned 64 bit integers from the underlying reader. Read more
fn read_u128_into<T>(&mut self, dst: &mut [u128]) -> Result<(), Error> where
T: ByteOrder,
fn read_u128_into<T>(&mut self, dst: &mut [u128]) -> Result<(), Error> where
T: ByteOrder,
Reads a sequence of unsigned 128 bit integers from the underlying reader. Read more
fn read_i8_into(&mut self, dst: &mut [i8]) -> Result<(), Error>
fn read_i8_into(&mut self, dst: &mut [i8]) -> Result<(), Error>
Reads a sequence of signed 8 bit integers from the underlying reader. Read more
fn read_i16_into<T>(&mut self, dst: &mut [i16]) -> Result<(), Error> where
T: ByteOrder,
fn read_i16_into<T>(&mut self, dst: &mut [i16]) -> Result<(), Error> where
T: ByteOrder,
Reads a sequence of signed 16 bit integers from the underlying reader. Read more
fn read_i32_into<T>(&mut self, dst: &mut [i32]) -> Result<(), Error> where
T: ByteOrder,
fn read_i32_into<T>(&mut self, dst: &mut [i32]) -> Result<(), Error> where
T: ByteOrder,
Reads a sequence of signed 32 bit integers from the underlying reader. Read more
fn read_i64_into<T>(&mut self, dst: &mut [i64]) -> Result<(), Error> where
T: ByteOrder,
fn read_i64_into<T>(&mut self, dst: &mut [i64]) -> Result<(), Error> where
T: ByteOrder,
Reads a sequence of signed 64 bit integers from the underlying reader. Read more
fn read_i128_into<T>(&mut self, dst: &mut [i128]) -> Result<(), Error> where
T: ByteOrder,
fn read_i128_into<T>(&mut self, dst: &mut [i128]) -> Result<(), Error> where
T: ByteOrder,
Reads a sequence of signed 128 bit integers from the underlying reader. Read more
fn read_f32_into<T>(&mut self, dst: &mut [f32]) -> Result<(), Error> where
T: ByteOrder,
fn read_f32_into<T>(&mut self, dst: &mut [f32]) -> Result<(), Error> where
T: ByteOrder,
Reads a sequence of IEEE754 single-precision (4 bytes) floating point numbers from the underlying reader. Read more
fn read_f32_into_unchecked<T>(&mut self, dst: &mut [f32]) -> Result<(), Error> where
T: ByteOrder,
fn read_f32_into_unchecked<T>(&mut self, dst: &mut [f32]) -> Result<(), Error> where
T: ByteOrder,
please use read_f32_into instead
DEPRECATED. Read more
sourceimpl<R> ReadEndian<[f32]> for R where
R: Read,
impl<R> ReadEndian<[f32]> for R where
R: Read,
sourcefn read_from_little_endian_into(
&mut self,
value: &mut [f32]
) -> Result<(), Error>
fn read_from_little_endian_into(
&mut self,
value: &mut [f32]
) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_big_endian_into(&mut self, value: &mut [f32]) -> Result<(), Error>
fn read_from_big_endian_into(&mut self, value: &mut [f32]) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
fn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourceimpl<R> ReadEndian<[f64]> for R where
R: Read,
impl<R> ReadEndian<[f64]> for R where
R: Read,
sourcefn read_from_little_endian_into(
&mut self,
value: &mut [f64]
) -> Result<(), Error>
fn read_from_little_endian_into(
&mut self,
value: &mut [f64]
) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_big_endian_into(&mut self, value: &mut [f64]) -> Result<(), Error>
fn read_from_big_endian_into(&mut self, value: &mut [f64]) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
fn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourceimpl<R> ReadEndian<[i128]> for R where
R: Read,
impl<R> ReadEndian<[i128]> for R where
R: Read,
sourcefn read_from_little_endian_into(
&mut self,
value: &mut [i128]
) -> Result<(), Error>
fn read_from_little_endian_into(
&mut self,
value: &mut [i128]
) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_big_endian_into(&mut self, value: &mut [i128]) -> Result<(), Error>
fn read_from_big_endian_into(&mut self, value: &mut [i128]) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
fn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourceimpl<R> ReadEndian<[i16]> for R where
R: Read,
impl<R> ReadEndian<[i16]> for R where
R: Read,
sourcefn read_from_little_endian_into(
&mut self,
value: &mut [i16]
) -> Result<(), Error>
fn read_from_little_endian_into(
&mut self,
value: &mut [i16]
) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_big_endian_into(&mut self, value: &mut [i16]) -> Result<(), Error>
fn read_from_big_endian_into(&mut self, value: &mut [i16]) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
fn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourceimpl<R> ReadEndian<[i32]> for R where
R: Read,
impl<R> ReadEndian<[i32]> for R where
R: Read,
sourcefn read_from_little_endian_into(
&mut self,
value: &mut [i32]
) -> Result<(), Error>
fn read_from_little_endian_into(
&mut self,
value: &mut [i32]
) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_big_endian_into(&mut self, value: &mut [i32]) -> Result<(), Error>
fn read_from_big_endian_into(&mut self, value: &mut [i32]) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
fn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourceimpl<R> ReadEndian<[i64]> for R where
R: Read,
impl<R> ReadEndian<[i64]> for R where
R: Read,
sourcefn read_from_little_endian_into(
&mut self,
value: &mut [i64]
) -> Result<(), Error>
fn read_from_little_endian_into(
&mut self,
value: &mut [i64]
) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_big_endian_into(&mut self, value: &mut [i64]) -> Result<(), Error>
fn read_from_big_endian_into(&mut self, value: &mut [i64]) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
fn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourceimpl<R> ReadEndian<[i8]> for R where
R: Read,
impl<R> ReadEndian<[i8]> for R where
R: Read,
sourcefn read_from_little_endian_into(
&mut self,
value: &mut [i8]
) -> Result<(), Error>
fn read_from_little_endian_into(
&mut self,
value: &mut [i8]
) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_big_endian_into(&mut self, value: &mut [i8]) -> Result<(), Error>
fn read_from_big_endian_into(&mut self, value: &mut [i8]) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
fn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourceimpl<R> ReadEndian<[u128]> for R where
R: Read,
impl<R> ReadEndian<[u128]> for R where
R: Read,
sourcefn read_from_little_endian_into(
&mut self,
value: &mut [u128]
) -> Result<(), Error>
fn read_from_little_endian_into(
&mut self,
value: &mut [u128]
) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_big_endian_into(&mut self, value: &mut [u128]) -> Result<(), Error>
fn read_from_big_endian_into(&mut self, value: &mut [u128]) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
fn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourceimpl<R> ReadEndian<[u16]> for R where
R: Read,
impl<R> ReadEndian<[u16]> for R where
R: Read,
sourcefn read_from_little_endian_into(
&mut self,
value: &mut [u16]
) -> Result<(), Error>
fn read_from_little_endian_into(
&mut self,
value: &mut [u16]
) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_big_endian_into(&mut self, value: &mut [u16]) -> Result<(), Error>
fn read_from_big_endian_into(&mut self, value: &mut [u16]) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
fn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourceimpl<R> ReadEndian<[u32]> for R where
R: Read,
impl<R> ReadEndian<[u32]> for R where
R: Read,
sourcefn read_from_little_endian_into(
&mut self,
value: &mut [u32]
) -> Result<(), Error>
fn read_from_little_endian_into(
&mut self,
value: &mut [u32]
) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_big_endian_into(&mut self, value: &mut [u32]) -> Result<(), Error>
fn read_from_big_endian_into(&mut self, value: &mut [u32]) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
fn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourceimpl<R> ReadEndian<[u64]> for R where
R: Read,
impl<R> ReadEndian<[u64]> for R where
R: Read,
sourcefn read_from_little_endian_into(
&mut self,
value: &mut [u64]
) -> Result<(), Error>
fn read_from_little_endian_into(
&mut self,
value: &mut [u64]
) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_big_endian_into(&mut self, value: &mut [u64]) -> Result<(), Error>
fn read_from_big_endian_into(&mut self, value: &mut [u64]) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
fn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourceimpl<R> ReadEndian<[u8]> for R where
R: Read,
impl<R> ReadEndian<[u8]> for R where
R: Read,
sourcefn read_from_little_endian_into(
&mut self,
value: &mut [u8]
) -> Result<(), Error>
fn read_from_little_endian_into(
&mut self,
value: &mut [u8]
) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_big_endian_into(&mut self, value: &mut [u8]) -> Result<(), Error>
fn read_from_big_endian_into(&mut self, value: &mut [u8]) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
fn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourceimpl<R> ReadEndian<f32> for R where
R: Read,
impl<R> ReadEndian<f32> for R where
R: Read,
sourcefn read_from_little_endian_into(&mut self, value: &mut f32) -> Result<(), Error>
fn read_from_little_endian_into(&mut self, value: &mut f32) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_big_endian_into(&mut self, value: &mut f32) -> Result<(), Error>
fn read_from_big_endian_into(&mut self, value: &mut f32) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
fn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourceimpl<R> ReadEndian<f64> for R where
R: Read,
impl<R> ReadEndian<f64> for R where
R: Read,
sourcefn read_from_little_endian_into(&mut self, value: &mut f64) -> Result<(), Error>
fn read_from_little_endian_into(&mut self, value: &mut f64) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_big_endian_into(&mut self, value: &mut f64) -> Result<(), Error>
fn read_from_big_endian_into(&mut self, value: &mut f64) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
fn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourceimpl<R> ReadEndian<i128> for R where
R: Read,
impl<R> ReadEndian<i128> for R where
R: Read,
sourcefn read_from_little_endian_into(
&mut self,
value: &mut i128
) -> Result<(), Error>
fn read_from_little_endian_into(
&mut self,
value: &mut i128
) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_big_endian_into(&mut self, value: &mut i128) -> Result<(), Error>
fn read_from_big_endian_into(&mut self, value: &mut i128) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
fn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourceimpl<R> ReadEndian<i16> for R where
R: Read,
impl<R> ReadEndian<i16> for R where
R: Read,
sourcefn read_from_little_endian_into(&mut self, value: &mut i16) -> Result<(), Error>
fn read_from_little_endian_into(&mut self, value: &mut i16) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_big_endian_into(&mut self, value: &mut i16) -> Result<(), Error>
fn read_from_big_endian_into(&mut self, value: &mut i16) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
fn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourceimpl<R> ReadEndian<i32> for R where
R: Read,
impl<R> ReadEndian<i32> for R where
R: Read,
sourcefn read_from_little_endian_into(&mut self, value: &mut i32) -> Result<(), Error>
fn read_from_little_endian_into(&mut self, value: &mut i32) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_big_endian_into(&mut self, value: &mut i32) -> Result<(), Error>
fn read_from_big_endian_into(&mut self, value: &mut i32) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
fn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourceimpl<R> ReadEndian<i64> for R where
R: Read,
impl<R> ReadEndian<i64> for R where
R: Read,
sourcefn read_from_little_endian_into(&mut self, value: &mut i64) -> Result<(), Error>
fn read_from_little_endian_into(&mut self, value: &mut i64) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_big_endian_into(&mut self, value: &mut i64) -> Result<(), Error>
fn read_from_big_endian_into(&mut self, value: &mut i64) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
fn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourceimpl<R> ReadEndian<i8> for R where
R: Read,
impl<R> ReadEndian<i8> for R where
R: Read,
sourcefn read_from_little_endian_into(&mut self, value: &mut i8) -> Result<(), Error>
fn read_from_little_endian_into(&mut self, value: &mut i8) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_big_endian_into(&mut self, value: &mut i8) -> Result<(), Error>
fn read_from_big_endian_into(&mut self, value: &mut i8) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
fn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourceimpl<R> ReadEndian<u128> for R where
R: Read,
impl<R> ReadEndian<u128> for R where
R: Read,
sourcefn read_from_little_endian_into(
&mut self,
value: &mut u128
) -> Result<(), Error>
fn read_from_little_endian_into(
&mut self,
value: &mut u128
) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_big_endian_into(&mut self, value: &mut u128) -> Result<(), Error>
fn read_from_big_endian_into(&mut self, value: &mut u128) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
fn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourceimpl<R> ReadEndian<u16> for R where
R: Read,
impl<R> ReadEndian<u16> for R where
R: Read,
sourcefn read_from_little_endian_into(&mut self, value: &mut u16) -> Result<(), Error>
fn read_from_little_endian_into(&mut self, value: &mut u16) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_big_endian_into(&mut self, value: &mut u16) -> Result<(), Error>
fn read_from_big_endian_into(&mut self, value: &mut u16) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
fn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourceimpl<R> ReadEndian<u32> for R where
R: Read,
impl<R> ReadEndian<u32> for R where
R: Read,
sourcefn read_from_little_endian_into(&mut self, value: &mut u32) -> Result<(), Error>
fn read_from_little_endian_into(&mut self, value: &mut u32) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_big_endian_into(&mut self, value: &mut u32) -> Result<(), Error>
fn read_from_big_endian_into(&mut self, value: &mut u32) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
fn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourceimpl<R> ReadEndian<u64> for R where
R: Read,
impl<R> ReadEndian<u64> for R where
R: Read,
sourcefn read_from_little_endian_into(&mut self, value: &mut u64) -> Result<(), Error>
fn read_from_little_endian_into(&mut self, value: &mut u64) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_big_endian_into(&mut self, value: &mut u64) -> Result<(), Error>
fn read_from_big_endian_into(&mut self, value: &mut u64) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
fn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourceimpl<R> ReadEndian<u8> for R where
R: Read,
impl<R> ReadEndian<u8> for R where
R: Read,
sourcefn read_from_little_endian_into(&mut self, value: &mut u8) -> Result<(), Error>
fn read_from_little_endian_into(&mut self, value: &mut u8) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_big_endian_into(&mut self, value: &mut u8) -> Result<(), Error>
fn read_from_big_endian_into(&mut self, value: &mut u8) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
fn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>
Read into the supplied reference. Acts the same as std::io::Read::read_exact.
sourcefn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_little_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_big_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourcefn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
fn read_from_native_endian(&mut self) -> Result<T, Error> where
T: Default,
Read the byte value of the inferred type
sourceimpl<R, P> ReadPrimitive<R> for P where
R: Read + ReadEndian<P>,
P: Default,
impl<R, P> ReadPrimitive<R> for P where
R: Read + ReadEndian<P>,
P: Default,
sourcefn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
sourcefn read_from_big_endian(read: &mut R) -> Result<Self, Error>
fn read_from_big_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
sourcefn read_from_native_endian(read: &mut R) -> Result<Self, Error>
fn read_from_native_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
sourceimpl<Target, Original> VectorizedInto<Target> for Original where
Target: VectorizedFrom<Original>,
impl<Target, Original> VectorizedInto<Target> for Original where
Target: VectorizedFrom<Original>,
sourcefn vectorized_into(self) -> Target
fn vectorized_into(self) -> Target
Performs the conversion.
impl<W> WriteBytesExt for W where
W: Write + ?Sized,
impl<W> WriteBytesExt for W where
W: Write + ?Sized,
fn write_u8(&mut self, n: u8) -> Result<(), Error>
fn write_u8(&mut self, n: u8) -> Result<(), Error>
Writes an unsigned 8 bit integer to the underlying writer. Read more
fn write_i8(&mut self, n: i8) -> Result<(), Error>
fn write_i8(&mut self, n: i8) -> Result<(), Error>
Writes a signed 8 bit integer to the underlying writer. Read more
fn write_u16<T>(&mut self, n: u16) -> Result<(), Error> where
T: ByteOrder,
fn write_u16<T>(&mut self, n: u16) -> Result<(), Error> where
T: ByteOrder,
Writes an unsigned 16 bit integer to the underlying writer. Read more
fn write_i16<T>(&mut self, n: i16) -> Result<(), Error> where
T: ByteOrder,
fn write_i16<T>(&mut self, n: i16) -> Result<(), Error> where
T: ByteOrder,
Writes a signed 16 bit integer to the underlying writer. Read more
fn write_u24<T>(&mut self, n: u32) -> Result<(), Error> where
T: ByteOrder,
fn write_u24<T>(&mut self, n: u32) -> Result<(), Error> where
T: ByteOrder,
Writes an unsigned 24 bit integer to the underlying writer. Read more
fn write_i24<T>(&mut self, n: i32) -> Result<(), Error> where
T: ByteOrder,
fn write_i24<T>(&mut self, n: i32) -> Result<(), Error> where
T: ByteOrder,
Writes a signed 24 bit integer to the underlying writer. Read more
fn write_u32<T>(&mut self, n: u32) -> Result<(), Error> where
T: ByteOrder,
fn write_u32<T>(&mut self, n: u32) -> Result<(), Error> where
T: ByteOrder,
Writes an unsigned 32 bit integer to the underlying writer. Read more
fn write_i32<T>(&mut self, n: i32) -> Result<(), Error> where
T: ByteOrder,
fn write_i32<T>(&mut self, n: i32) -> Result<(), Error> where
T: ByteOrder,
Writes a signed 32 bit integer to the underlying writer. Read more
fn write_u48<T>(&mut self, n: u64) -> Result<(), Error> where
T: ByteOrder,
fn write_u48<T>(&mut self, n: u64) -> Result<(), Error> where
T: ByteOrder,
Writes an unsigned 48 bit integer to the underlying writer. Read more
fn write_i48<T>(&mut self, n: i64) -> Result<(), Error> where
T: ByteOrder,
fn write_i48<T>(&mut self, n: i64) -> Result<(), Error> where
T: ByteOrder,
Writes a signed 48 bit integer to the underlying writer. Read more
fn write_u64<T>(&mut self, n: u64) -> Result<(), Error> where
T: ByteOrder,
fn write_u64<T>(&mut self, n: u64) -> Result<(), Error> where
T: ByteOrder,
Writes an unsigned 64 bit integer to the underlying writer. Read more
fn write_i64<T>(&mut self, n: i64) -> Result<(), Error> where
T: ByteOrder,
fn write_i64<T>(&mut self, n: i64) -> Result<(), Error> where
T: ByteOrder,
Writes a signed 64 bit integer to the underlying writer. Read more
fn write_u128<T>(&mut self, n: u128) -> Result<(), Error> where
T: ByteOrder,
fn write_u128<T>(&mut self, n: u128) -> Result<(), Error> where
T: ByteOrder,
Writes an unsigned 128 bit integer to the underlying writer.
fn write_i128<T>(&mut self, n: i128) -> Result<(), Error> where
T: ByteOrder,
fn write_i128<T>(&mut self, n: i128) -> Result<(), Error> where
T: ByteOrder,
Writes a signed 128 bit integer to the underlying writer.
fn write_uint<T>(&mut self, n: u64, nbytes: usize) -> Result<(), Error> where
T: ByteOrder,
fn write_uint<T>(&mut self, n: u64, nbytes: usize) -> Result<(), Error> where
T: ByteOrder,
Writes an unsigned n-bytes integer to the underlying writer. Read more
fn write_int<T>(&mut self, n: i64, nbytes: usize) -> Result<(), Error> where
T: ByteOrder,
fn write_int<T>(&mut self, n: i64, nbytes: usize) -> Result<(), Error> where
T: ByteOrder,
Writes a signed n-bytes integer to the underlying writer. Read more
fn write_uint128<T>(&mut self, n: u128, nbytes: usize) -> Result<(), Error> where
T: ByteOrder,
fn write_uint128<T>(&mut self, n: u128, nbytes: usize) -> Result<(), Error> where
T: ByteOrder,
Writes an unsigned n-bytes integer to the underlying writer. Read more
fn write_int128<T>(&mut self, n: i128, nbytes: usize) -> Result<(), Error> where
T: ByteOrder,
fn write_int128<T>(&mut self, n: i128, nbytes: usize) -> Result<(), Error> where
T: ByteOrder,
Writes a signed n-bytes integer to the underlying writer. Read more
sourceimpl<W> WriteEndian<[f32]> for W where
W: Write,
impl<W> WriteEndian<[f32]> for W where
W: Write,
sourcefn write_as_little_endian(&mut self, value: &[f32]) -> Result<(), Error>
fn write_as_little_endian(&mut self, value: &[f32]) -> Result<(), Error>
Write the byte value of the specified reference, converting it to little endianness
sourceimpl<W> WriteEndian<[f64]> for W where
W: Write,
impl<W> WriteEndian<[f64]> for W where
W: Write,
sourcefn write_as_little_endian(&mut self, value: &[f64]) -> Result<(), Error>
fn write_as_little_endian(&mut self, value: &[f64]) -> Result<(), Error>
Write the byte value of the specified reference, converting it to little endianness
sourceimpl<W> WriteEndian<[i128]> for W where
W: Write,
impl<W> WriteEndian<[i128]> for W where
W: Write,
sourcefn write_as_little_endian(&mut self, value: &[i128]) -> Result<(), Error>
fn write_as_little_endian(&mut self, value: &[i128]) -> Result<(), Error>
Write the byte value of the specified reference, converting it to little endianness
sourceimpl<W> WriteEndian<[i16]> for W where
W: Write,
impl<W> WriteEndian<[i16]> for W where
W: Write,
sourcefn write_as_little_endian(&mut self, value: &[i16]) -> Result<(), Error>
fn write_as_little_endian(&mut self, value: &[i16]) -> Result<(), Error>
Write the byte value of the specified reference, converting it to little endianness
sourceimpl<W> WriteEndian<[i32]> for W where
W: Write,
impl<W> WriteEndian<[i32]> for W where
W: Write,
sourcefn write_as_little_endian(&mut self, value: &[i32]) -> Result<(), Error>
fn write_as_little_endian(&mut self, value: &[i32]) -> Result<(), Error>
Write the byte value of the specified reference, converting it to little endianness
sourceimpl<W> WriteEndian<[i64]> for W where
W: Write,
impl<W> WriteEndian<[i64]> for W where
W: Write,
sourcefn write_as_little_endian(&mut self, value: &[i64]) -> Result<(), Error>
fn write_as_little_endian(&mut self, value: &[i64]) -> Result<(), Error>
Write the byte value of the specified reference, converting it to little endianness
sourceimpl<W> WriteEndian<[i8]> for W where
W: Write,
impl<W> WriteEndian<[i8]> for W where
W: Write,
sourcefn write_as_little_endian(&mut self, value: &[i8]) -> Result<(), Error>
fn write_as_little_endian(&mut self, value: &[i8]) -> Result<(), Error>
Write the byte value of the specified reference, converting it to little endianness
sourceimpl<W> WriteEndian<[u128]> for W where
W: Write,
impl<W> WriteEndian<[u128]> for W where
W: Write,
sourcefn write_as_little_endian(&mut self, value: &[u128]) -> Result<(), Error>
fn write_as_little_endian(&mut self, value: &[u128]) -> Result<(), Error>
Write the byte value of the specified reference, converting it to little endianness
sourceimpl<W> WriteEndian<[u16]> for W where
W: Write,
impl<W> WriteEndian<[u16]> for W where
W: Write,
sourcefn write_as_little_endian(&mut self, value: &[u16]) -> Result<(), Error>
fn write_as_little_endian(&mut self, value: &[u16]) -> Result<(), Error>
Write the byte value of the specified reference, converting it to little endianness
sourceimpl<W> WriteEndian<[u32]> for W where
W: Write,
impl<W> WriteEndian<[u32]> for W where
W: Write,
sourcefn write_as_little_endian(&mut self, value: &[u32]) -> Result<(), Error>
fn write_as_little_endian(&mut self, value: &[u32]) -> Result<(), Error>
Write the byte value of the specified reference, converting it to little endianness
sourceimpl<W> WriteEndian<[u64]> for W where
W: Write,
impl<W> WriteEndian<[u64]> for W where
W: Write,
sourcefn write_as_little_endian(&mut self, value: &[u64]) -> Result<(), Error>
fn write_as_little_endian(&mut self, value: &[u64]) -> Result<(), Error>
Write the byte value of the specified reference, converting it to little endianness
sourceimpl<W> WriteEndian<[u8]> for W where
W: Write,
impl<W> WriteEndian<[u8]> for W where
W: Write,
sourcefn write_as_little_endian(&mut self, value: &[u8]) -> Result<(), Error>
fn write_as_little_endian(&mut self, value: &[u8]) -> Result<(), Error>
Write the byte value of the specified reference, converting it to little endianness
sourceimpl<W> WriteEndian<f32> for W where
W: Write,
impl<W> WriteEndian<f32> for W where
W: Write,
sourcefn write_as_little_endian(&mut self, value: &f32) -> Result<(), Error>
fn write_as_little_endian(&mut self, value: &f32) -> Result<(), Error>
Write the byte value of the specified reference, converting it to little endianness
sourceimpl<W> WriteEndian<f64> for W where
W: Write,
impl<W> WriteEndian<f64> for W where
W: Write,
sourcefn write_as_little_endian(&mut self, value: &f64) -> Result<(), Error>
fn write_as_little_endian(&mut self, value: &f64) -> Result<(), Error>
Write the byte value of the specified reference, converting it to little endianness
sourceimpl<W> WriteEndian<i128> for W where
W: Write,
impl<W> WriteEndian<i128> for W where
W: Write,
sourcefn write_as_little_endian(&mut self, value: &i128) -> Result<(), Error>
fn write_as_little_endian(&mut self, value: &i128) -> Result<(), Error>
Write the byte value of the specified reference, converting it to little endianness
sourceimpl<W> WriteEndian<i16> for W where
W: Write,
impl<W> WriteEndian<i16> for W where
W: Write,
sourcefn write_as_little_endian(&mut self, value: &i16) -> Result<(), Error>
fn write_as_little_endian(&mut self, value: &i16) -> Result<(), Error>
Write the byte value of the specified reference, converting it to little endianness
sourceimpl<W> WriteEndian<i32> for W where
W: Write,
impl<W> WriteEndian<i32> for W where
W: Write,
sourcefn write_as_little_endian(&mut self, value: &i32) -> Result<(), Error>
fn write_as_little_endian(&mut self, value: &i32) -> Result<(), Error>
Write the byte value of the specified reference, converting it to little endianness
sourceimpl<W> WriteEndian<i64> for W where
W: Write,
impl<W> WriteEndian<i64> for W where
W: Write,
sourcefn write_as_little_endian(&mut self, value: &i64) -> Result<(), Error>
fn write_as_little_endian(&mut self, value: &i64) -> Result<(), Error>
Write the byte value of the specified reference, converting it to little endianness
sourceimpl<W> WriteEndian<i8> for W where
W: Write,
impl<W> WriteEndian<i8> for W where
W: Write,
sourcefn write_as_little_endian(&mut self, value: &i8) -> Result<(), Error>
fn write_as_little_endian(&mut self, value: &i8) -> Result<(), Error>
Write the byte value of the specified reference, converting it to little endianness
sourceimpl<W> WriteEndian<u128> for W where
W: Write,
impl<W> WriteEndian<u128> for W where
W: Write,
sourcefn write_as_little_endian(&mut self, value: &u128) -> Result<(), Error>
fn write_as_little_endian(&mut self, value: &u128) -> Result<(), Error>
Write the byte value of the specified reference, converting it to little endianness
sourceimpl<W> WriteEndian<u16> for W where
W: Write,
impl<W> WriteEndian<u16> for W where
W: Write,
sourcefn write_as_little_endian(&mut self, value: &u16) -> Result<(), Error>
fn write_as_little_endian(&mut self, value: &u16) -> Result<(), Error>
Write the byte value of the specified reference, converting it to little endianness
sourceimpl<W> WriteEndian<u32> for W where
W: Write,
impl<W> WriteEndian<u32> for W where
W: Write,
sourcefn write_as_little_endian(&mut self, value: &u32) -> Result<(), Error>
fn write_as_little_endian(&mut self, value: &u32) -> Result<(), Error>
Write the byte value of the specified reference, converting it to little endianness
sourceimpl<W> WriteEndian<u64> for W where
W: Write,
impl<W> WriteEndian<u64> for W where
W: Write,
sourcefn write_as_little_endian(&mut self, value: &u64) -> Result<(), Error>
fn write_as_little_endian(&mut self, value: &u64) -> Result<(), Error>
Write the byte value of the specified reference, converting it to little endianness
sourceimpl<W> WriteEndian<u8> for W where
W: Write,
impl<W> WriteEndian<u8> for W where
W: Write,
sourcefn write_as_little_endian(&mut self, value: &u8) -> Result<(), Error>
fn write_as_little_endian(&mut self, value: &u8) -> Result<(), Error>
Write the byte value of the specified reference, converting it to little endianness
