Fn fromvec vec
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. Reserves capacity for at least additional more elements to be inserted in the BinaryHeap. The collection may reserve more space to avoid frequent reallocations. Removes the greatest item from the binary heap and returns it, or None if it is empty. Moves all the elements of other into self , leaving other empty. Creates an iterator from a value. Creates a consuming iterator, that is, one that moves each value out of the binary heap in arbitrary order.
The binary heap cannot be used after calling this. Place is the intermediate agent guarding the uninitialized state for Data. Formats the value using the given formatter.
Creates a value from an iterator. Extends a collection with the contents of an iterator. Performs copy-assignment from source. This will be a max-heap. Returns an iterator visiting all values in the underlying vector, in arbitrary order. Returns the greatest item in the binary heap, or None if it is empty. This method returns an Ordering between self and other. Compares and returns the maximum of two values. Compares and returns the minimum of two values. This method returns an ordering between self and other values if one exists.
Executes the destructor for this type. Creates an iterator from a value. A double-ended queue implemented with a growable ring buffer. Creates an empty VecDeque. VecDeque ; let vector: Creates an empty VecDeque with space for at least n elements.
Retrieves an element in the VecDeque by index. Element at index 0 is the front of the queue. Retrieves an element in the VecDeque mutably by index. Swaps elements at indices i and j.
Panics Panics if either index is out of bounds. Returns the number of elements the VecDeque can hold without reallocating. VecDeque ; let buf: Panics Panics if the new capacity overflows usize. VecDeque ; let mut buf: Shrinks the capacity of the VecDeque as much as possible. Shortens the VecDeque , dropping excess elements from the back. Returns a front-to-back iterator. Returns a front-to-back iterator that returns mutable references. Returns a pair of slices which contain, in order, the contents of the VecDeque.
Returns the number of elements in the VecDeque. Returns true if the VecDeque is empty. The element range is removed even if the iterator is not consumed until the end. Panics Panics if the starting point is greater than the end point or if the end point is greater than the length of the vector.
VecDeque ; let mut v: Clears the buffer, removing all values. VecDeque ; let mut vector: Prepends an element to the VecDeque. Appends an element to the back of the VecDeque. This does not preserve ordering, but is O 1. Panics Panics if index is greater than VecDeque 's length Examples use std:: Splits the collection into two at the given index.
Note that the capacity of self does not change. Panics Panics if the new number of elements in self overflows a usize.