[−][src]Struct sortedvec::example::ExampleSortedVec
Sorted vector type that provides quick access to T
s through K
s.
Methods
impl ExampleSortedVec
[src]
impl ExampleSortedVec
pub fn find(&self, key: &K) -> Option<&T> | [src] |
Tries to find an element in the collection with the given key. It has logarithmic worst case time complexity.
pub fn contains(&self, key: &K) -> bool | [src] |
Checks whether there is a value with that key in the collection. This is
done in O(log(n))
time.
pub fn insert(&mut self, val: T) | [src] |
Inserts a new value into the collection, maintaining the internal
order invariant. This is an O(n)
operation.
pub fn split_off(&mut self, at: usize) -> Self | [src] |
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
Panics if at > len
.
pub fn dedup(&mut self) | [src] |
Removes all elements but one that resolve to the same key.
pub fn pop(&mut self) -> Option<T> | [src] |
Removes and returns the greatest element with the respect to
the generated keys. An O(1)
operation.
Methods from Deref<Target = Vec<T>>
pub fn capacity(&self) -> usize | 1.0.0 [src] |
Returns the number of elements the vector can hold without reallocating.
Examples
let vec: Vec<i32> = Vec::with_capacity(10); assert_eq!(vec.capacity(), 10);
pub fn as_slice(&self) -> &[T] | 1.7.0 [src] |
Extracts a slice containing the entire vector.
Equivalent to &s[..]
.
Examples
use std::io::{self, Write}; let buffer = vec![1, 2, 3, 5, 8]; io::sink().write(buffer.as_slice()).unwrap();
pub fn len(&self) -> usize | 1.0.0 [src] |
Returns the number of elements in the vector, also referred to as its 'length'.
Examples
let a = vec![1, 2, 3]; assert_eq!(a.len(), 3);
pub fn is_empty(&self) -> bool | 1.0.0 [src] |
Returns true
if the vector contains no elements.
Examples
let mut v = Vec::new(); assert!(v.is_empty()); v.push(1); assert!(!v.is_empty());
Trait Implementations
impl From<Vec<T>> for ExampleSortedVec
[src]
impl From<Vec<T>> for ExampleSortedVec
impl IntoIterator for ExampleSortedVec
[src]
impl IntoIterator for ExampleSortedVec
type Item = T
The type of the elements being iterated over.
type IntoIter = IntoIter<T>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter | [src] |
impl Into<Vec<T>> for ExampleSortedVec
[src]
impl Into<Vec<T>> for ExampleSortedVec
impl Extend<T> for ExampleSortedVec
[src]
impl Extend<T> for ExampleSortedVec
fn extend<I>(&mut self, iter: I) where | [src] |
impl Default for ExampleSortedVec
[src]
impl Default for ExampleSortedVec
impl AsRef<[T]> for ExampleSortedVec
[src]
impl AsRef<[T]> for ExampleSortedVec
impl AsRef<Vec<T>> for ExampleSortedVec
[src]
impl AsRef<Vec<T>> for ExampleSortedVec
impl Deref for ExampleSortedVec
[src]
impl Deref for ExampleSortedVec
impl FromIterator<T> for ExampleSortedVec
[src]
impl FromIterator<T> for ExampleSortedVec
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self | [src] |
impl Borrow<[T]> for ExampleSortedVec
[src]
impl Borrow<[T]> for ExampleSortedVec
Auto Trait Implementations
impl Send for ExampleSortedVec
impl Send for ExampleSortedVec
impl Sync for ExampleSortedVec
impl Sync for ExampleSortedVec
Blanket Implementations
impl<T> From for T
[src]
impl<T> From for T
impl<I> IntoIterator for I where
I: Iterator,
[src]
impl<I> IntoIterator for I where
I: Iterator,
type Item = <I as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = I
Which kind of iterator are we turning this into?
fn into_iter(self) -> I | [src] |
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> | [src] |
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T | [src] |
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error> | [src] |
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId | [src] |