Trait FunctionalVec

Source
pub trait FunctionalVec
where Self: Sized,
{ type Item;
Show 25 methods // Required methods fn append_new(self, other: Self) -> Self; fn clear_new(self) -> Self; fn dedup_new(self) -> Self where Self::Item: PartialEq; fn dedup_by_new<F>(self, same_bucket: F) -> Self where F: FnMut(&mut Self::Item, &mut Self::Item) -> bool; fn dedup_by_key_new<F, K>(self, same_bucket: F) -> Self where F: FnMut(&mut Self::Item) -> K, K: PartialEq<K>; fn extend_from_slice_new(self, other: &[Self::Item]) -> Self where Self::Item: Clone; fn extend_from_within_new<R>(self, src: R) -> Self where Self::Item: Clone, R: RangeBounds<usize>; fn insert_new(self, index: usize, element: Self::Item) -> Self; fn remove_new(self, index: usize) -> (Self::Item, Self); fn resize_new(self, new_len: usize, value: Self::Item) -> Self where Self::Item: Clone; fn resize_with_new<F>(self, new_len: usize, f: F) -> Self where F: FnMut() -> Self::Item; fn reserve_new(self, additional: usize) -> Self; fn reserve_exact_new(self, additional: usize) -> Self; fn push_new(self, item: Self::Item) -> Self; fn pop_new(self) -> (Option<Self::Item>, Self); fn retain_new<F>(self, f: F) -> Self where F: FnMut(&Self::Item) -> bool; fn retain_mut_new<F>(self, f: F) -> Self where F: FnMut(&mut Self::Item) -> bool; unsafe fn set_len_new(self, new_len: usize) -> Self; fn shrink_to_new(self, min_capacity: usize) -> Self; fn shrink_to_fit_new(self) -> Self; fn split_off_new(self, at: usize) -> (Self, Self); fn swap_remove_new(self, index: usize) -> (Self::Item, Self); fn truncate_new(self, len: usize) -> Self; fn try_reserve_new( self, additional: usize, ) -> (Result<(), TryReserveError>, Self); fn try_reserve_exact_new( self, additional: usize, ) -> (Result<(), TryReserveError>, Self);
}

Required Associated Types§

Required Methods§

Source

fn append_new(self, other: Self) -> Self

Source

fn clear_new(self) -> Self

Source

fn dedup_new(self) -> Self
where Self::Item: PartialEq,

Source

fn dedup_by_new<F>(self, same_bucket: F) -> Self
where F: FnMut(&mut Self::Item, &mut Self::Item) -> bool,

Source

fn dedup_by_key_new<F, K>(self, same_bucket: F) -> Self
where F: FnMut(&mut Self::Item) -> K, K: PartialEq<K>,

Source

fn extend_from_slice_new(self, other: &[Self::Item]) -> Self
where Self::Item: Clone,

Source

fn extend_from_within_new<R>(self, src: R) -> Self
where Self::Item: Clone, R: RangeBounds<usize>,

Source

fn insert_new(self, index: usize, element: Self::Item) -> Self

Source

fn remove_new(self, index: usize) -> (Self::Item, Self)

Source

fn resize_new(self, new_len: usize, value: Self::Item) -> Self
where Self::Item: Clone,

Source

fn resize_with_new<F>(self, new_len: usize, f: F) -> Self
where F: FnMut() -> Self::Item,

Source

fn reserve_new(self, additional: usize) -> Self

Source

fn reserve_exact_new(self, additional: usize) -> Self

Source

fn push_new(self, item: Self::Item) -> Self

Source

fn pop_new(self) -> (Option<Self::Item>, Self)

Source

fn retain_new<F>(self, f: F) -> Self
where F: FnMut(&Self::Item) -> bool,

Source

fn retain_mut_new<F>(self, f: F) -> Self
where F: FnMut(&mut Self::Item) -> bool,

Source

unsafe fn set_len_new(self, new_len: usize) -> Self

Source

fn shrink_to_new(self, min_capacity: usize) -> Self

Source

fn shrink_to_fit_new(self) -> Self

Source

fn split_off_new(self, at: usize) -> (Self, Self)

Source

fn swap_remove_new(self, index: usize) -> (Self::Item, Self)

Source

fn truncate_new(self, len: usize) -> Self

Source

fn try_reserve_new( self, additional: usize, ) -> (Result<(), TryReserveError>, Self)

Source

fn try_reserve_exact_new( self, additional: usize, ) -> (Result<(), TryReserveError>, Self)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T: Sized> FunctionalVec for Vec<T>

Source§

fn push_new(self, item: Self::Item) -> Self

use functional_vec::FunctionalVec;

let v = (0..10).fold(Vec::new(), |acc, curr| acc.push_new(curr));
assert_eq!(v, vec![0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
Source§

type Item = T

Source§

fn append_new(self, other: Self) -> Self

Source§

fn clear_new(self) -> Self

Source§

fn dedup_new(self) -> Self
where T: PartialEq,

Source§

fn dedup_by_new<F>(self, same_bucket: F) -> Self
where F: FnMut(&mut Self::Item, &mut Self::Item) -> bool,

Source§

fn dedup_by_key_new<F, K>(self, same_bucket: F) -> Self
where F: FnMut(&mut Self::Item) -> K, K: PartialEq<K>,

Source§

fn extend_from_slice_new(self, other: &[Self::Item]) -> Self
where T: Clone,

Source§

fn extend_from_within_new<R>(self, src: R) -> Self
where T: Clone, R: RangeBounds<usize>,

Source§

fn insert_new(self, index: usize, element: Self::Item) -> Self

Source§

fn remove_new(self, index: usize) -> (Self::Item, Self)

Source§

fn resize_new(self, new_len: usize, value: Self::Item) -> Self
where Self::Item: Clone,

Source§

fn resize_with_new<F>(self, new_len: usize, f: F) -> Self
where F: FnMut() -> Self::Item,

Source§

fn reserve_new(self, additional: usize) -> Self

Source§

fn reserve_exact_new(self, additional: usize) -> Self

Source§

fn pop_new(self) -> (Option<Self::Item>, Self)

Source§

fn retain_new<F>(self, f: F) -> Self
where F: FnMut(&Self::Item) -> bool,

Source§

fn retain_mut_new<F>(self, f: F) -> Self
where F: FnMut(&mut Self::Item) -> bool,

Source§

unsafe fn set_len_new(self, new_len: usize) -> Self

Source§

fn shrink_to_new(self, min_capacity: usize) -> Self

Source§

fn shrink_to_fit_new(self) -> Self

Source§

fn split_off_new(self, at: usize) -> (Self, Self)

Source§

fn swap_remove_new(self, index: usize) -> (Self::Item, Self)

Source§

fn truncate_new(self, len: usize) -> Self

Source§

fn try_reserve_new( self, additional: usize, ) -> (Result<(), TryReserveError>, Self)

Source§

fn try_reserve_exact_new( self, additional: usize, ) -> (Result<(), TryReserveError>, Self)

Implementors§