pub struct Chain<T> { /* private fields */ }Implementations§
Source§impl<T, const N: usize> Chain<[T; N]>
impl<T, const N: usize> Chain<[T; N]>
Source§impl<'h, T, const N: usize> Chain<&'h mut [T; N]>
impl<'h, T, const N: usize> Chain<&'h mut [T; N]>
Source§impl<K, V, S> Chain<HashMap<K, V, S>>
impl<K, V, S> Chain<HashMap<K, V, S>>
Sourcepub fn clear(self) -> Self
pub fn clear(self) -> Self
See documentation for HashMap::clear for more details on the underlying function.
Sourcepub fn len(self, out: impl Output<usize>) -> Self
pub fn len(self, out: impl Output<usize>) -> Self
See documentation for HashMap::len for more details on the underlying function.
Source§impl<'h, K, V, S> Chain<&'h mut HashMap<K, V, S>>
impl<'h, K, V, S> Chain<&'h mut HashMap<K, V, S>>
Sourcepub fn clear(self) -> Self
pub fn clear(self) -> Self
See documentation for HashMap::clear for more details on the underlying function.
Sourcepub fn len(self, out: impl Output<usize>) -> Self
pub fn len(self, out: impl Output<usize>) -> Self
See documentation for HashMap::len for more details on the underlying function.
Source§impl<K, V> Chain<BTreeMap<K, V>>
impl<K, V> Chain<BTreeMap<K, V>>
Sourcepub fn clear(self) -> Self
pub fn clear(self) -> Self
See documentation for BTreeMap::clear for more details on the underlying function.
Sourcepub fn len(self, out: impl Output<usize>) -> Self
pub fn len(self, out: impl Output<usize>) -> Self
See documentation for BTreeMap::len for more details on the underlying function.
Source§impl<'h, K, V> Chain<&'h mut BTreeMap<K, V>>
impl<'h, K, V> Chain<&'h mut BTreeMap<K, V>>
Sourcepub fn clear(self) -> Self
pub fn clear(self) -> Self
See documentation for BTreeMap::clear for more details on the underlying function.
Sourcepub fn len(self, out: impl Output<usize>) -> Self
pub fn len(self, out: impl Output<usize>) -> Self
See documentation for BTreeMap::len for more details on the underlying function.
Source§impl<K, V, S> Chain<HashMap<K, V, S>>
impl<K, V, S> Chain<HashMap<K, V, S>>
Sourcepub fn insert(self, k: K, v: V, out: impl Output<Option<V>>) -> Self
pub fn insert(self, k: K, v: V, out: impl Output<Option<V>>) -> Self
See documentation for HashMap::insert for more details on the underlying function.
Source§impl<'h, K, V, S> Chain<&'h mut HashMap<K, V, S>>
impl<'h, K, V, S> Chain<&'h mut HashMap<K, V, S>>
Sourcepub fn insert(self, k: K, v: V, out: impl Output<Option<V>>) -> Self
pub fn insert(self, k: K, v: V, out: impl Output<Option<V>>) -> Self
See documentation for HashMap::insert for more details on the underlying function.
Source§impl<T, S> Chain<HashSet<T, S>>
impl<T, S> Chain<HashSet<T, S>>
Sourcepub fn clear(self) -> Self
pub fn clear(self) -> Self
See documentation for HashSet::clear for more details on the underlying function.
Sourcepub fn len(self, out: impl Output<usize>) -> Self
pub fn len(self, out: impl Output<usize>) -> Self
See documentation for HashSet::len for more details on the underlying function.
Source§impl<'h, T, S> Chain<&'h mut HashSet<T, S>>
impl<'h, T, S> Chain<&'h mut HashSet<T, S>>
Sourcepub fn clear(self) -> Self
pub fn clear(self) -> Self
See documentation for HashSet::clear for more details on the underlying function.
Sourcepub fn len(self, out: impl Output<usize>) -> Self
pub fn len(self, out: impl Output<usize>) -> Self
See documentation for HashSet::len for more details on the underlying function.
Source§impl<T> Chain<BTreeSet<T>>
impl<T> Chain<BTreeSet<T>>
Sourcepub fn clear(self) -> Self
pub fn clear(self) -> Self
See documentation for BTreeSet::clear for more details on the underlying function.
Sourcepub fn len(self, out: impl Output<usize>) -> Self
pub fn len(self, out: impl Output<usize>) -> Self
See documentation for BTreeSet::len for more details on the underlying function.
Source§impl<'h, T> Chain<&'h mut BTreeSet<T>>
impl<'h, T> Chain<&'h mut BTreeSet<T>>
Sourcepub fn clear(self) -> Self
pub fn clear(self) -> Self
See documentation for BTreeSet::clear for more details on the underlying function.
Sourcepub fn len(self, out: impl Output<usize>) -> Self
pub fn len(self, out: impl Output<usize>) -> Self
See documentation for BTreeSet::len for more details on the underlying function.
Source§impl Chain<String>
impl Chain<String>
Sourcepub fn clear(self) -> Self
pub fn clear(self) -> Self
See documentation for String::clear for more details on the underlying function.
Sourcepub fn len(self, out: impl Output<usize>) -> Self
pub fn len(self, out: impl Output<usize>) -> Self
See documentation for String::len for more details on the underlying function.
Sourcepub fn push(self, ch: char) -> Self
pub fn push(self, ch: char) -> Self
See documentation for String::push for more details on the underlying function.
Sourcepub fn push_str(self, string: &str) -> Self
pub fn push_str(self, string: &str) -> Self
See documentation for String::push_str for more details on the underlying function.
Sourcepub fn reserve(self, additional: usize) -> Self
pub fn reserve(self, additional: usize) -> Self
See documentation for String::reserve for more details on the underlying function.
Sourcepub fn reserve_exact(self, additional: usize) -> Self
pub fn reserve_exact(self, additional: usize) -> Self
See documentation for String::reserve_exact for more details on the underlying function.
Source§impl<'h> Chain<&'h mut String>
impl<'h> Chain<&'h mut String>
Sourcepub fn clear(self) -> Self
pub fn clear(self) -> Self
See documentation for String::clear for more details on the underlying function.
Sourcepub fn len(self, out: impl Output<usize>) -> Self
pub fn len(self, out: impl Output<usize>) -> Self
See documentation for String::len for more details on the underlying function.
Sourcepub fn push(self, ch: char) -> Self
pub fn push(self, ch: char) -> Self
See documentation for String::push for more details on the underlying function.
Sourcepub fn push_str(self, string: &str) -> Self
pub fn push_str(self, string: &str) -> Self
See documentation for String::push_str for more details on the underlying function.
Sourcepub fn reserve(self, additional: usize) -> Self
pub fn reserve(self, additional: usize) -> Self
See documentation for String::reserve for more details on the underlying function.
Sourcepub fn reserve_exact(self, additional: usize) -> Self
pub fn reserve_exact(self, additional: usize) -> Self
See documentation for String::reserve_exact for more details on the underlying function.
Source§impl<T> Chain<Vec<T>>
impl<T> Chain<Vec<T>>
Sourcepub unsafe fn align_to<U>(self, cb: impl FnOnce((&[T], &[U], &[T]))) -> Self
pub unsafe fn align_to<U>(self, cb: impl FnOnce((&[T], &[U], &[T]))) -> Self
§Safety
You must uphold safety invariants of [T]::align_to.
See documentation for [T]::align_to for more details on the underlying function.
Sourcepub unsafe fn align_to_mut<U>(
self,
cb: impl FnOnce((&mut [T], &mut [U], &mut [T])),
) -> Self
pub unsafe fn align_to_mut<U>( self, cb: impl FnOnce((&mut [T], &mut [U], &mut [T])), ) -> Self
§Safety
You must uphold safety invariants of [T]::align_to_mut.
See documentation for [T]::align_to_mut for more details on the underlying function.
Sourcepub fn append(self, other: &mut impl ChainConversions<Inner = Vec<T>>) -> Self
pub fn append(self, other: &mut impl ChainConversions<Inner = Vec<T>>) -> Self
See documentation for Vec::append for more details on the underlying function.
Sourcepub fn binary_search(
self,
x: &T,
out: impl Output<Result<usize, usize>>,
) -> Selfwhere
T: Ord,
pub fn binary_search(
self,
x: &T,
out: impl Output<Result<usize, usize>>,
) -> Selfwhere
T: Ord,
See documentation for [T]::binary_search for more details on the underlying function.
Sourcepub fn binary_search_by(
self,
f: impl FnMut(&T) -> Ordering,
out: impl Output<Result<usize, usize>>,
) -> Self
pub fn binary_search_by( self, f: impl FnMut(&T) -> Ordering, out: impl Output<Result<usize, usize>>, ) -> Self
See documentation for [T]::binary_search_by for more details on the underlying function.
Sourcepub fn binary_search_by_key<B>(
self,
b: &B,
f: impl FnMut(&T) -> B,
out: impl Output<Result<usize, usize>>,
) -> Selfwhere
B: Ord,
pub fn binary_search_by_key<B>(
self,
b: &B,
f: impl FnMut(&T) -> B,
out: impl Output<Result<usize, usize>>,
) -> Selfwhere
B: Ord,
See documentation for [T]::binary_search_by_key for more details on the underlying function.
Sourcepub fn capacity(self, out: impl Output<usize>) -> Self
pub fn capacity(self, out: impl Output<usize>) -> Self
See documentation for Vec::capacity for more details on the underlying function.
Sourcepub fn clear(self) -> Self
pub fn clear(self) -> Self
See documentation for Vec::clear for more details on the underlying function.
Sourcepub fn dedup(self) -> Selfwhere
T: PartialEq,
pub fn dedup(self) -> Selfwhere
T: PartialEq,
See documentation for Vec::dedup for more details on the underlying function.
Sourcepub fn dedup_by(self, same_bucket: impl FnMut(&mut T, &mut T) -> bool) -> Self
pub fn dedup_by(self, same_bucket: impl FnMut(&mut T, &mut T) -> bool) -> Self
See documentation for Vec::dedup_by for more details on the underlying function.
Sourcepub fn dedup_by_key<K>(self, key: impl FnMut(&mut T) -> K) -> Selfwhere
K: PartialEq,
pub fn dedup_by_key<K>(self, key: impl FnMut(&mut T) -> K) -> Selfwhere
K: PartialEq,
See documentation for Vec::dedup_by_key for more details on the underlying function.
Sourcepub fn fill(self, value: T) -> Selfwhere
T: Clone,
pub fn fill(self, value: T) -> Selfwhere
T: Clone,
See documentation for [T]::fill for more details on the underlying function.
Sourcepub fn fill_with(self, f: impl FnMut() -> T) -> Self
pub fn fill_with(self, f: impl FnMut() -> T) -> Self
See documentation for [T]::fill_with for more details on the underlying function.
Sourcepub fn insert(self, index: usize, element: T) -> Self
pub fn insert(self, index: usize, element: T) -> Self
See documentation for Vec::insert for more details on the underlying function.
Sourcepub fn is_empty(self, out: impl Output<bool>) -> Self
pub fn is_empty(self, out: impl Output<bool>) -> Self
See documentation for Vec::is_empty for more details on the underlying function.
Sourcepub fn len(self, out: impl Output<usize>) -> Self
pub fn len(self, out: impl Output<usize>) -> Self
See documentation for Vec::len for more details on the underlying function.
Sourcepub fn pop(self, out: impl Output<Option<T>>) -> Self
pub fn pop(self, out: impl Output<Option<T>>) -> Self
See documentation for Vec::pop for more details on the underlying function.
Sourcepub fn push(self, value: T) -> Self
pub fn push(self, value: T) -> Self
See documentation for Vec::push for more details on the underlying function.
Sourcepub fn remove(self, index: usize, out: impl Output<T>) -> Self
pub fn remove(self, index: usize, out: impl Output<T>) -> Self
See documentation for Vec::remove for more details on the underlying function.
Sourcepub fn reserve(self, additional: usize) -> Self
pub fn reserve(self, additional: usize) -> Self
See documentation for Vec::reserve for more details on the underlying function.
Sourcepub fn reserve_exact(self, additional: usize) -> Self
pub fn reserve_exact(self, additional: usize) -> Self
See documentation for Vec::reserve_exact for more details on the underlying function.
Sourcepub fn resize(self, new_len: usize, value: T) -> Selfwhere
T: Clone,
pub fn resize(self, new_len: usize, value: T) -> Selfwhere
T: Clone,
See documentation for Vec::resize for more details on the underlying function.
Sourcepub fn resize_with(self, new_len: usize, f: impl FnMut() -> T) -> Self
pub fn resize_with(self, new_len: usize, f: impl FnMut() -> T) -> Self
See documentation for Vec::resize_with for more details on the underlying function.
Sourcepub fn retain(self, f: impl FnMut(&T) -> bool) -> Self
pub fn retain(self, f: impl FnMut(&T) -> bool) -> Self
See documentation for Vec::retain for more details on the underlying function.
Sourcepub fn retain_mut(self, f: impl FnMut(&mut T) -> bool) -> Self
pub fn retain_mut(self, f: impl FnMut(&mut T) -> bool) -> Self
See documentation for Vec::retain_mut for more details on the underlying function.
Sourcepub unsafe fn set_len(self, new_len: usize) -> Self
pub unsafe fn set_len(self, new_len: usize) -> Self
§Safety
You must uphold safety invariants of Vec::set_len.
See documentation for Vec::set_len for more details on the underlying function.
Sourcepub fn shrink_to(self, min_capacity: usize) -> Self
pub fn shrink_to(self, min_capacity: usize) -> Self
See documentation for Vec::shrink_to for more details on the underlying function.
Sourcepub fn shrink_to_fit(self) -> Self
pub fn shrink_to_fit(self) -> Self
See documentation for Vec::shrink_to_fit for more details on the underlying function.
Sourcepub fn sort(self) -> Selfwhere
T: Ord,
pub fn sort(self) -> Selfwhere
T: Ord,
See documentation for [T]::sort for more details on the underlying function.
Sourcepub fn sort_by(self, compare: impl FnMut(&T, &T) -> Ordering) -> Self
pub fn sort_by(self, compare: impl FnMut(&T, &T) -> Ordering) -> Self
See documentation for [T]::sort_by for more details on the underlying function.
Sourcepub fn sort_by_key<K>(self, f: impl FnMut(&T) -> K) -> Selfwhere
K: Ord,
pub fn sort_by_key<K>(self, f: impl FnMut(&T) -> K) -> Selfwhere
K: Ord,
See documentation for [T]::sort_by_key for more details on the underlying function.
Sourcepub fn sort_by_cached_key<K>(self, f: impl FnMut(&T) -> K) -> Selfwhere
K: Ord,
pub fn sort_by_cached_key<K>(self, f: impl FnMut(&T) -> K) -> Selfwhere
K: Ord,
See documentation for [T]::sort_by_cached_key for more details on the underlying function.
Sourcepub fn spare_capacity_mut(self, cb: impl FnOnce(&mut [MaybeUninit<T>])) -> Self
pub fn spare_capacity_mut(self, cb: impl FnOnce(&mut [MaybeUninit<T>])) -> Self
See documentation for Vec::spare_capacity_mut for more details on the underlying function.
Source§impl<'h, T> Chain<&'h mut Vec<T>>
impl<'h, T> Chain<&'h mut Vec<T>>
Sourcepub unsafe fn align_to<U>(self, cb: impl FnOnce((&[T], &[U], &[T]))) -> Self
pub unsafe fn align_to<U>(self, cb: impl FnOnce((&[T], &[U], &[T]))) -> Self
§Safety
You must uphold safety invariants of [T]::align_to.
See documentation for [T]::align_to for more details on the underlying function.
Sourcepub unsafe fn align_to_mut<U>(
self,
cb: impl FnOnce((&mut [T], &mut [U], &mut [T])),
) -> Self
pub unsafe fn align_to_mut<U>( self, cb: impl FnOnce((&mut [T], &mut [U], &mut [T])), ) -> Self
§Safety
You must uphold safety invariants of [T]::align_to_mut.
See documentation for [T]::align_to_mut for more details on the underlying function.
Sourcepub fn append(self, other: &mut impl ChainConversions<Inner = Vec<T>>) -> Self
pub fn append(self, other: &mut impl ChainConversions<Inner = Vec<T>>) -> Self
See documentation for Vec::append for more details on the underlying function.
Sourcepub fn binary_search(
self,
x: &T,
out: impl Output<Result<usize, usize>>,
) -> Selfwhere
T: Ord,
pub fn binary_search(
self,
x: &T,
out: impl Output<Result<usize, usize>>,
) -> Selfwhere
T: Ord,
See documentation for [T]::binary_search for more details on the underlying function.
Sourcepub fn binary_search_by(
self,
f: impl FnMut(&T) -> Ordering,
out: impl Output<Result<usize, usize>>,
) -> Self
pub fn binary_search_by( self, f: impl FnMut(&T) -> Ordering, out: impl Output<Result<usize, usize>>, ) -> Self
See documentation for [T]::binary_search_by for more details on the underlying function.
Sourcepub fn binary_search_by_key<B>(
self,
b: &B,
f: impl FnMut(&T) -> B,
out: impl Output<Result<usize, usize>>,
) -> Selfwhere
B: Ord,
pub fn binary_search_by_key<B>(
self,
b: &B,
f: impl FnMut(&T) -> B,
out: impl Output<Result<usize, usize>>,
) -> Selfwhere
B: Ord,
See documentation for [T]::binary_search_by_key for more details on the underlying function.
Sourcepub fn capacity(self, out: impl Output<usize>) -> Self
pub fn capacity(self, out: impl Output<usize>) -> Self
See documentation for Vec::capacity for more details on the underlying function.
Sourcepub fn clear(self) -> Self
pub fn clear(self) -> Self
See documentation for Vec::clear for more details on the underlying function.
Sourcepub fn dedup(self) -> Selfwhere
T: PartialEq,
pub fn dedup(self) -> Selfwhere
T: PartialEq,
See documentation for Vec::dedup for more details on the underlying function.
Sourcepub fn dedup_by(self, same_bucket: impl FnMut(&mut T, &mut T) -> bool) -> Self
pub fn dedup_by(self, same_bucket: impl FnMut(&mut T, &mut T) -> bool) -> Self
See documentation for Vec::dedup_by for more details on the underlying function.
Sourcepub fn dedup_by_key<K>(self, key: impl FnMut(&mut T) -> K) -> Selfwhere
K: PartialEq,
pub fn dedup_by_key<K>(self, key: impl FnMut(&mut T) -> K) -> Selfwhere
K: PartialEq,
See documentation for Vec::dedup_by_key for more details on the underlying function.
Sourcepub fn fill(self, value: T) -> Selfwhere
T: Clone,
pub fn fill(self, value: T) -> Selfwhere
T: Clone,
See documentation for [T]::fill for more details on the underlying function.
Sourcepub fn fill_with(self, f: impl FnMut() -> T) -> Self
pub fn fill_with(self, f: impl FnMut() -> T) -> Self
See documentation for [T]::fill_with for more details on the underlying function.
Sourcepub fn insert(self, index: usize, element: T) -> Self
pub fn insert(self, index: usize, element: T) -> Self
See documentation for Vec::insert for more details on the underlying function.
Sourcepub fn is_empty(self, out: impl Output<bool>) -> Self
pub fn is_empty(self, out: impl Output<bool>) -> Self
See documentation for Vec::is_empty for more details on the underlying function.
Sourcepub fn len(self, out: impl Output<usize>) -> Self
pub fn len(self, out: impl Output<usize>) -> Self
See documentation for Vec::len for more details on the underlying function.
Sourcepub fn pop(self, out: impl Output<Option<T>>) -> Self
pub fn pop(self, out: impl Output<Option<T>>) -> Self
See documentation for Vec::pop for more details on the underlying function.
Sourcepub fn push(self, value: T) -> Self
pub fn push(self, value: T) -> Self
See documentation for Vec::push for more details on the underlying function.
Sourcepub fn remove(self, index: usize, out: impl Output<T>) -> Self
pub fn remove(self, index: usize, out: impl Output<T>) -> Self
See documentation for Vec::remove for more details on the underlying function.
Sourcepub fn reserve(self, additional: usize) -> Self
pub fn reserve(self, additional: usize) -> Self
See documentation for Vec::reserve for more details on the underlying function.
Sourcepub fn reserve_exact(self, additional: usize) -> Self
pub fn reserve_exact(self, additional: usize) -> Self
See documentation for Vec::reserve_exact for more details on the underlying function.
Sourcepub fn resize(self, new_len: usize, value: T) -> Selfwhere
T: Clone,
pub fn resize(self, new_len: usize, value: T) -> Selfwhere
T: Clone,
See documentation for Vec::resize for more details on the underlying function.
Sourcepub fn resize_with(self, new_len: usize, f: impl FnMut() -> T) -> Self
pub fn resize_with(self, new_len: usize, f: impl FnMut() -> T) -> Self
See documentation for Vec::resize_with for more details on the underlying function.
Sourcepub fn retain(self, f: impl FnMut(&T) -> bool) -> Self
pub fn retain(self, f: impl FnMut(&T) -> bool) -> Self
See documentation for Vec::retain for more details on the underlying function.
Sourcepub fn retain_mut(self, f: impl FnMut(&mut T) -> bool) -> Self
pub fn retain_mut(self, f: impl FnMut(&mut T) -> bool) -> Self
See documentation for Vec::retain_mut for more details on the underlying function.
Sourcepub unsafe fn set_len(self, new_len: usize) -> Self
pub unsafe fn set_len(self, new_len: usize) -> Self
§Safety
You must uphold safety invariants of Vec::set_len.
See documentation for Vec::set_len for more details on the underlying function.
Sourcepub fn shrink_to(self, min_capacity: usize) -> Self
pub fn shrink_to(self, min_capacity: usize) -> Self
See documentation for Vec::shrink_to for more details on the underlying function.
Sourcepub fn shrink_to_fit(self) -> Self
pub fn shrink_to_fit(self) -> Self
See documentation for Vec::shrink_to_fit for more details on the underlying function.
Sourcepub fn sort(self) -> Selfwhere
T: Ord,
pub fn sort(self) -> Selfwhere
T: Ord,
See documentation for [T]::sort for more details on the underlying function.
Sourcepub fn sort_by(self, compare: impl FnMut(&T, &T) -> Ordering) -> Self
pub fn sort_by(self, compare: impl FnMut(&T, &T) -> Ordering) -> Self
See documentation for [T]::sort_by for more details on the underlying function.
Sourcepub fn sort_by_key<K>(self, f: impl FnMut(&T) -> K) -> Selfwhere
K: Ord,
pub fn sort_by_key<K>(self, f: impl FnMut(&T) -> K) -> Selfwhere
K: Ord,
See documentation for [T]::sort_by_key for more details on the underlying function.
Sourcepub fn sort_by_cached_key<K>(self, f: impl FnMut(&T) -> K) -> Selfwhere
K: Ord,
pub fn sort_by_cached_key<K>(self, f: impl FnMut(&T) -> K) -> Selfwhere
K: Ord,
See documentation for [T]::sort_by_cached_key for more details on the underlying function.
Sourcepub fn spare_capacity_mut(self, cb: impl FnOnce(&mut [MaybeUninit<T>])) -> Self
pub fn spare_capacity_mut(self, cb: impl FnOnce(&mut [MaybeUninit<T>])) -> Self
See documentation for Vec::spare_capacity_mut for more details on the underlying function.
Source§impl<T> Chain<T>
impl<T> Chain<T>
pub fn from_inner(inner: T) -> Self
pub fn into_inner(self) -> T
pub fn as_inner(&self) -> &T
pub fn as_inner_mut(&mut self) -> &mut T
Sourcepub fn with_inner(self, f: impl FnOnce(&mut T)) -> Self
pub fn with_inner(self, f: impl FnOnce(&mut T)) -> Self
Takes a closure that is called, passing in a reference to the inner value
This is useful for if there is something we have not implemented, or you otherwise need to borrow the inner struct for something, but are in the middle of some chain. It lets you do otherwise nonchainable operations inline with other chaining operations, so no need to break the chain c:
§Examples
let chain = VecChain::<usize>::new();
// let's pretend `push` and `reserve` don't already have chainable versions...
let chain = chain
.with_inner(|v| v.reserve(10))
.with_inner(|v| v.push(1))
.with_inner(|v| v.push(2));
assert!(chain.as_inner().len() == 2);
assert!(chain.as_inner().capacity() >= 10);