Trait fera_ext::VecExt [] [src]

pub trait VecExt<T> {
    unsafe fn new_uninitialized(len: usize) -> Self;
fn appended(self, other: &mut Self) -> Self;
fn deduped(self) -> Self
    where
        T: PartialEq
;
fn deduped_by<F>(self, same_bucket: F) -> Self
    where
        F: FnMut(&mut T, &mut T) -> bool
;
fn deduped_by_key<F, K>(self, key: F) -> Self
    where
        F: FnMut(&mut T) -> K,
        K: PartialEq<K>
;
fn resized(self, new_len: usize, value: T) -> Self
    where
        T: Clone
;
fn reversed(self) -> Self;
fn shrinked_to_fit(self) -> Self;
fn shuffled(self) -> Self;
fn shuffled_with<R: Rng>(self, rng: R) -> Self;
fn sorted(self) -> Self
    where
        T: Ord
;
fn sorted_by<F>(self, compare: F) -> Self
    where
        F: FnMut(&T, &T) -> Ordering
;
fn sorted_by_key<F, K>(self, key: F) -> Self
    where
        F: FnMut(&T) -> K,
        K: Ord
;
fn truncated(self, len: usize) -> Self; }

An extension trait for std::vec::Vec.

Methods with the suffix ed are like the original methods, but consumes the vector. This is interesting to chain methods call. For example:

use fera_ext::VecExt;

assert_eq!(vec![1, 2, 3], vec![4, 3, 1, 3, 4, 2].sorted().deduped().truncated(3));

Required Methods

Creates a new vector with len uninitialized elements.

Safety

This is unsafe because some values may not be dropped or some values may be dropped without being initialized. See std::mem::uninitialized for more informations.

Shuffle this vector using rand::weak_rng.

Shuffle this vector using rng.

Implementations on Foreign Types

impl<T> VecExt<T> for Vec<T>
[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

Implementors