pub struct ExampleSortedVec { /* fields omitted */ }
Sorted vector type that provides quick access to T
s through K
s.
Tries to find an element in the collection with the given key. It has
logarithmic worst case time complexity.
Checks whether there is a value with that key in the collection. This is
done in O(log(n))
time.
Removes and returns a single value from the collection with the given key,
if it exists. This operation has linear worst-case time complexity.
Inserts a new value into the collection, maintaining the internal
order invariant. This is an O(n)
operation.
Splits the collection into two at the given index.
Returns a newly allocated Self
. self
contains elements [0, at)
,
and the returned Self
contains elements [at, len)
.
Note that the capacity of self
does not change.
Panics if at > len
.
Removes all elements but one that resolve to the same key.
Removes and returns the greatest element with the respect to
the generated keys. An O(1)
operation.
Returns the number of elements the vector can hold without
reallocating.
let vec: Vec<i32> = Vec::with_capacity(10);
assert_eq!(vec.capacity(), 10);
Extracts a slice containing the entire vector.
Equivalent to &s[..]
.
use std::io::{self, Write};
let buffer = vec![1, 2, 3, 5, 8];
io::sink().write(buffer.as_slice()).unwrap();
Returns the number of elements in the vector, also referred to
as its 'length'.
let a = vec![1, 2, 3];
assert_eq!(a.len(), 3);
Returns true
if the vector contains no elements.
let mut v = Vec::new();
assert!(v.is_empty());
v.push(1);
assert!(!v.is_empty());
The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Extends a collection with the contents of an iterator. Read more
Returns the "default value" for a type. Read more
Performs copy-assignment from source
. Read more
Formats the value using the given formatter. Read more
The resulting type after dereferencing.
Immutably borrows from an owned value. Read more
The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static