Struct Chain

Source
pub struct Chain<T> { /* private fields */ }

Implementations§

Source§

impl<T, const N: usize> Chain<[T; N]>

Source

pub fn as_slice(self, cb: impl FnOnce(&[T])) -> Chain<[T; N]>

See documentation for [slice::as_slice] for more details on the underlying function.

Source

pub fn each_ref(self, cb: impl FnOnce([&T; N])) -> Chain<[T; N]>

See documentation for [slice::each_ref] for more details on the underlying function.

Source

pub fn each_mut(self, cb: impl FnOnce([&mut T; N])) -> Chain<[T; N]>

See documentation for [slice::each_mut] for more details on the underlying function.

Source§

impl<'h, T, const N: usize> Chain<&'h mut [T; N]>

Source

pub fn as_slice(self, cb: impl FnOnce(&[T])) -> Chain<&'h mut [T; N]>

See documentation for [slice::as_slice] for more details on the underlying function.

Source

pub fn each_ref(self, cb: impl FnOnce([&T; N])) -> Chain<&'h mut [T; N]>

See documentation for [slice::each_ref] for more details on the underlying function.

Source

pub fn each_mut(self, cb: impl FnOnce([&mut T; N])) -> Chain<&'h mut [T; N]>

See documentation for [slice::each_mut] for more details on the underlying function.

Source§

impl Chain<String>

Source

pub fn clear(self) -> Chain<String>

See documentation for String::clear for more details on the underlying function.

Source

pub fn len(self, out: impl Output<usize>) -> Chain<String>

See documentation for String::len for more details on the underlying function.

Source

pub fn push(self, ch: char) -> Chain<String>

See documentation for String::push for more details on the underlying function.

Source

pub fn push_str(self, string: &str) -> Chain<String>

See documentation for String::push_str for more details on the underlying function.

Source

pub fn reserve(self, additional: usize) -> Chain<String>

See documentation for String::reserve for more details on the underlying function.

Source

pub fn reserve_exact(self, additional: usize) -> Chain<String>

See documentation for String::reserve_exact for more details on the underlying function.

Source

pub fn retain(self, f: impl FnMut(char) -> bool) -> Chain<String>

See documentation for String::retain for more details on the underlying function.

Source§

impl<'h> Chain<&'h mut String>

Source

pub fn clear(self) -> Chain<&'h mut String>

See documentation for String::clear for more details on the underlying function.

Source

pub fn len(self, out: impl Output<usize>) -> Chain<&'h mut String>

See documentation for String::len for more details on the underlying function.

Source

pub fn push(self, ch: char) -> Chain<&'h mut String>

See documentation for String::push for more details on the underlying function.

Source

pub fn push_str(self, string: &str) -> Chain<&'h mut String>

See documentation for String::push_str for more details on the underlying function.

Source

pub fn reserve(self, additional: usize) -> Chain<&'h mut String>

See documentation for String::reserve for more details on the underlying function.

Source

pub fn reserve_exact(self, additional: usize) -> Chain<&'h mut String>

See documentation for String::reserve_exact for more details on the underlying function.

Source

pub fn retain(self, f: impl FnMut(char) -> bool) -> Chain<&'h mut String>

See documentation for String::retain for more details on the underlying function.

Source§

impl<T> Chain<Vec<T>>

Source

pub unsafe fn align_to<U>( self, cb: impl FnOnce((&[T], &[U], &[T])), ) -> Chain<Vec<T>>

§Safety

You must uphold safety invariants of [T]::align_to.

See documentation for [T]::align_to for more details on the underlying function.

Source

pub unsafe fn align_to_mut<U>( self, cb: impl FnOnce((&mut [T], &mut [U], &mut [T])), ) -> Chain<Vec<T>>

§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.

Source

pub fn append( self, other: &mut impl ChainConversions<Inner = Vec<T>>, ) -> Chain<Vec<T>>

See documentation for Vec::append for more details on the underlying function.

See documentation for [T]::binary_search for more details on the underlying function.

Source

pub fn binary_search_by( self, f: impl FnMut(&T) -> Ordering, out: impl Output<Result<usize, usize>>, ) -> Chain<Vec<T>>

See documentation for [T]::binary_search_by for more details on the underlying function.

Source

pub fn binary_search_by_key<B>( self, b: &B, f: impl FnMut(&T) -> B, out: impl Output<Result<usize, usize>>, ) -> Chain<Vec<T>>
where B: Ord,

See documentation for [T]::binary_search_by_key for more details on the underlying function.

Source

pub fn capacity(self, out: impl Output<usize>) -> Chain<Vec<T>>

See documentation for Vec::capacity for more details on the underlying function.

Source

pub fn clear(self) -> Chain<Vec<T>>

See documentation for Vec::clear for more details on the underlying function.

Source

pub fn dedup(self) -> Chain<Vec<T>>
where T: PartialEq,

See documentation for Vec::dedup for more details on the underlying function.

Source

pub fn dedup_by( self, same_bucket: impl FnMut(&mut T, &mut T) -> bool, ) -> Chain<Vec<T>>

See documentation for Vec::dedup_by for more details on the underlying function.

Source

pub fn dedup_by_key<K>(self, key: impl FnMut(&mut T) -> K) -> Chain<Vec<T>>
where K: PartialEq,

See documentation for Vec::dedup_by_key for more details on the underlying function.

Source

pub fn fill(self, value: T) -> Chain<Vec<T>>
where T: Clone,

See documentation for [T]::fill for more details on the underlying function.

Source

pub fn fill_with(self, f: impl FnMut() -> T) -> Chain<Vec<T>>

See documentation for [T]::fill_with for more details on the underlying function.

Source

pub fn insert(self, index: usize, element: T) -> Chain<Vec<T>>

See documentation for Vec::insert for more details on the underlying function.

Source

pub fn is_empty(self, out: impl Output<bool>) -> Chain<Vec<T>>

See documentation for Vec::is_empty for more details on the underlying function.

Source

pub fn len(self, out: impl Output<usize>) -> Chain<Vec<T>>

See documentation for Vec::len for more details on the underlying function.

Source

pub fn pop(self, out: impl Output<Option<T>>) -> Chain<Vec<T>>

See documentation for Vec::pop for more details on the underlying function.

Source

pub fn push(self, value: T) -> Chain<Vec<T>>

See documentation for Vec::push for more details on the underlying function.

Source

pub fn remove(self, index: usize, out: impl Output<T>) -> Chain<Vec<T>>

See documentation for Vec::remove for more details on the underlying function.

Source

pub fn reserve(self, additional: usize) -> Chain<Vec<T>>

See documentation for Vec::reserve for more details on the underlying function.

Source

pub fn reserve_exact(self, additional: usize) -> Chain<Vec<T>>

See documentation for Vec::reserve_exact for more details on the underlying function.

Source

pub fn resize(self, new_len: usize, value: T) -> Chain<Vec<T>>
where T: Clone,

See documentation for Vec::resize for more details on the underlying function.

Source

pub fn resize_with(self, new_len: usize, f: impl FnMut() -> T) -> Chain<Vec<T>>

See documentation for Vec::resize_with for more details on the underlying function.

Source

pub fn retain(self, f: impl FnMut(&T) -> bool) -> Chain<Vec<T>>

See documentation for Vec::retain for more details on the underlying function.

Source

pub fn retain_mut(self, f: impl FnMut(&mut T) -> bool) -> Chain<Vec<T>>

See documentation for Vec::retain_mut for more details on the underlying function.

Source

pub unsafe fn set_len(self, new_len: usize) -> Chain<Vec<T>>

§Safety

You must uphold safety invariants of Vec::set_len.

See documentation for Vec::set_len for more details on the underlying function.

Source

pub fn shrink_to(self, min_capacity: usize) -> Chain<Vec<T>>

See documentation for Vec::shrink_to for more details on the underlying function.

Source

pub fn shrink_to_fit(self) -> Chain<Vec<T>>

See documentation for Vec::shrink_to_fit for more details on the underlying function.

Source

pub fn sort(self) -> Chain<Vec<T>>
where T: Ord,

See documentation for [T]::sort for more details on the underlying function.

Source

pub fn sort_by(self, compare: impl FnMut(&T, &T) -> Ordering) -> Chain<Vec<T>>

See documentation for [T]::sort_by for more details on the underlying function.

Source

pub fn sort_by_key<K>(self, f: impl FnMut(&T) -> K) -> Chain<Vec<T>>
where K: Ord,

See documentation for [T]::sort_by_key for more details on the underlying function.

Source

pub fn sort_by_cached_key<K>(self, f: impl FnMut(&T) -> K) -> Chain<Vec<T>>
where K: Ord,

See documentation for [T]::sort_by_cached_key for more details on the underlying function.

Source

pub fn spare_capacity_mut( self, cb: impl FnOnce(&mut [MaybeUninit<T>]), ) -> Chain<Vec<T>>

See documentation for Vec::spare_capacity_mut for more details on the underlying function.

Source§

impl<'h, T> Chain<&'h mut Vec<T>>

Source

pub unsafe fn align_to<U>( self, cb: impl FnOnce((&[T], &[U], &[T])), ) -> Chain<&'h mut Vec<T>>

§Safety

You must uphold safety invariants of [T]::align_to.

See documentation for [T]::align_to for more details on the underlying function.

Source

pub unsafe fn align_to_mut<U>( self, cb: impl FnOnce((&mut [T], &mut [U], &mut [T])), ) -> Chain<&'h mut Vec<T>>

§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.

Source

pub fn append( self, other: &mut impl ChainConversions<Inner = Vec<T>>, ) -> Chain<&'h mut Vec<T>>

See documentation for Vec::append for more details on the underlying function.

Source

pub fn binary_search( self, x: &T, out: impl Output<Result<usize, usize>>, ) -> Chain<&'h mut Vec<T>>
where T: Ord,

See documentation for [T]::binary_search for more details on the underlying function.

Source

pub fn binary_search_by( self, f: impl FnMut(&T) -> Ordering, out: impl Output<Result<usize, usize>>, ) -> Chain<&'h mut Vec<T>>

See documentation for [T]::binary_search_by for more details on the underlying function.

Source

pub fn binary_search_by_key<B>( self, b: &B, f: impl FnMut(&T) -> B, out: impl Output<Result<usize, usize>>, ) -> Chain<&'h mut Vec<T>>
where B: Ord,

See documentation for [T]::binary_search_by_key for more details on the underlying function.

Source

pub fn capacity(self, out: impl Output<usize>) -> Chain<&'h mut Vec<T>>

See documentation for Vec::capacity for more details on the underlying function.

Source

pub fn clear(self) -> Chain<&'h mut Vec<T>>

See documentation for Vec::clear for more details on the underlying function.

Source

pub fn dedup(self) -> Chain<&'h mut Vec<T>>
where T: PartialEq,

See documentation for Vec::dedup for more details on the underlying function.

Source

pub fn dedup_by( self, same_bucket: impl FnMut(&mut T, &mut T) -> bool, ) -> Chain<&'h mut Vec<T>>

See documentation for Vec::dedup_by for more details on the underlying function.

Source

pub fn dedup_by_key<K>( self, key: impl FnMut(&mut T) -> K, ) -> Chain<&'h mut Vec<T>>
where K: PartialEq,

See documentation for Vec::dedup_by_key for more details on the underlying function.

Source

pub fn fill(self, value: T) -> Chain<&'h mut Vec<T>>
where T: Clone,

See documentation for [T]::fill for more details on the underlying function.

Source

pub fn fill_with(self, f: impl FnMut() -> T) -> Chain<&'h mut Vec<T>>

See documentation for [T]::fill_with for more details on the underlying function.

Source

pub fn insert(self, index: usize, element: T) -> Chain<&'h mut Vec<T>>

See documentation for Vec::insert for more details on the underlying function.

Source

pub fn is_empty(self, out: impl Output<bool>) -> Chain<&'h mut Vec<T>>

See documentation for Vec::is_empty for more details on the underlying function.

Source

pub fn len(self, out: impl Output<usize>) -> Chain<&'h mut Vec<T>>

See documentation for Vec::len for more details on the underlying function.

Source

pub fn pop(self, out: impl Output<Option<T>>) -> Chain<&'h mut Vec<T>>

See documentation for Vec::pop for more details on the underlying function.

Source

pub fn push(self, value: T) -> Chain<&'h mut Vec<T>>

See documentation for Vec::push for more details on the underlying function.

Source

pub fn remove(self, index: usize, out: impl Output<T>) -> Chain<&'h mut Vec<T>>

See documentation for Vec::remove for more details on the underlying function.

Source

pub fn reserve(self, additional: usize) -> Chain<&'h mut Vec<T>>

See documentation for Vec::reserve for more details on the underlying function.

Source

pub fn reserve_exact(self, additional: usize) -> Chain<&'h mut Vec<T>>

See documentation for Vec::reserve_exact for more details on the underlying function.

Source

pub fn resize(self, new_len: usize, value: T) -> Chain<&'h mut Vec<T>>
where T: Clone,

See documentation for Vec::resize for more details on the underlying function.

Source

pub fn resize_with( self, new_len: usize, f: impl FnMut() -> T, ) -> Chain<&'h mut Vec<T>>

See documentation for Vec::resize_with for more details on the underlying function.

Source

pub fn retain(self, f: impl FnMut(&T) -> bool) -> Chain<&'h mut Vec<T>>

See documentation for Vec::retain for more details on the underlying function.

Source

pub fn retain_mut(self, f: impl FnMut(&mut T) -> bool) -> Chain<&'h mut Vec<T>>

See documentation for Vec::retain_mut for more details on the underlying function.

Source

pub unsafe fn set_len(self, new_len: usize) -> Chain<&'h mut Vec<T>>

§Safety

You must uphold safety invariants of Vec::set_len.

See documentation for Vec::set_len for more details on the underlying function.

Source

pub fn shrink_to(self, min_capacity: usize) -> Chain<&'h mut Vec<T>>

See documentation for Vec::shrink_to for more details on the underlying function.

Source

pub fn shrink_to_fit(self) -> Chain<&'h mut Vec<T>>

See documentation for Vec::shrink_to_fit for more details on the underlying function.

Source

pub fn sort(self) -> Chain<&'h mut Vec<T>>
where T: Ord,

See documentation for [T]::sort for more details on the underlying function.

Source

pub fn sort_by( self, compare: impl FnMut(&T, &T) -> Ordering, ) -> Chain<&'h mut Vec<T>>

See documentation for [T]::sort_by for more details on the underlying function.

Source

pub fn sort_by_key<K>(self, f: impl FnMut(&T) -> K) -> Chain<&'h mut Vec<T>>
where K: Ord,

See documentation for [T]::sort_by_key for more details on the underlying function.

Source

pub fn sort_by_cached_key<K>( self, f: impl FnMut(&T) -> K, ) -> Chain<&'h mut Vec<T>>
where K: Ord,

See documentation for [T]::sort_by_cached_key for more details on the underlying function.

Source

pub fn spare_capacity_mut( self, cb: impl FnOnce(&mut [MaybeUninit<T>]), ) -> Chain<&'h mut Vec<T>>

See documentation for Vec::spare_capacity_mut for more details on the underlying function.

Source§

impl<T> Chain<T>

Source

pub fn from_inner(inner: T) -> Chain<T>

Source

pub fn into_inner(self) -> T

Source

pub fn as_inner(&self) -> &T

Source

pub fn as_inner_mut(&mut self) -> &mut T

Source

pub fn with_inner(self, f: impl FnOnce(&mut T)) -> Chain<T>

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);

Trait Implementations§

Source§

impl<'h, T, const N: usize> ChainConversions for Chain<&'h mut [T; N]>

Source§

type Inner = [T; N]

Source§

type MutChain<'mut_chain> = Chain<&'mut_chain mut [T; N]> where Chain<&'h mut [T; N]>: 'mut_chain

Source§

fn as_inner(&self) -> &<Chain<&'h mut [T; N]> as ChainConversions>::Inner

Source§

fn as_inner_mut( &mut self, ) -> &mut <Chain<&'h mut [T; N]> as ChainConversions>::Inner

Source§

fn as_mut_chain(&mut self) -> Chain<&mut [T; N]>

Source§

impl<'h> ChainConversions for Chain<&'h mut String>

Source§

type Inner = String

Source§

type MutChain<'mut_chain> = Chain<&'mut_chain mut String> where Chain<&'h mut String>: 'mut_chain

Source§

fn as_inner(&self) -> &<Chain<&'h mut String> as ChainConversions>::Inner

Source§

fn as_inner_mut( &mut self, ) -> &mut <Chain<&'h mut String> as ChainConversions>::Inner

Source§

fn as_mut_chain(&mut self) -> Chain<&mut String>

Source§

impl<'h, T> ChainConversions for Chain<&'h mut Vec<T>>

Source§

type Inner = Vec<T>

Source§

type MutChain<'mut_chain> = Chain<&'mut_chain mut Vec<T>> where Chain<&'h mut Vec<T>>: 'mut_chain

Source§

fn as_inner(&self) -> &<Chain<&'h mut Vec<T>> as ChainConversions>::Inner

Source§

fn as_inner_mut( &mut self, ) -> &mut <Chain<&'h mut Vec<T>> as ChainConversions>::Inner

Source§

fn as_mut_chain(&mut self) -> Chain<&mut Vec<T>>

Source§

impl<T, const N: usize> ChainConversions for Chain<[T; N]>

Source§

type Inner = [T; N]

Source§

type MutChain<'mut_chain> = Chain<&'mut_chain mut [T; N]> where Chain<[T; N]>: 'mut_chain

Source§

fn as_inner(&self) -> &<Chain<[T; N]> as ChainConversions>::Inner

Source§

fn as_inner_mut(&mut self) -> &mut <Chain<[T; N]> as ChainConversions>::Inner

Source§

fn as_mut_chain(&mut self) -> Chain<&mut [T; N]>

Source§

impl ChainConversions for Chain<String>

Source§

type Inner = String

Source§

type MutChain<'mut_chain> = Chain<&'mut_chain mut String> where Chain<String>: 'mut_chain

Source§

fn as_inner(&self) -> &<Chain<String> as ChainConversions>::Inner

Source§

fn as_inner_mut(&mut self) -> &mut <Chain<String> as ChainConversions>::Inner

Source§

fn as_mut_chain(&mut self) -> Chain<&mut String>

Source§

impl<T> ChainConversions for Chain<Vec<T>>

Source§

type Inner = Vec<T>

Source§

type MutChain<'mut_chain> = Chain<&'mut_chain mut Vec<T>> where Chain<Vec<T>>: 'mut_chain

Source§

fn as_inner(&self) -> &<Chain<Vec<T>> as ChainConversions>::Inner

Source§

fn as_inner_mut(&mut self) -> &mut <Chain<Vec<T>> as ChainConversions>::Inner

Source§

fn as_mut_chain(&mut self) -> Chain<&mut Vec<T>>

Source§

impl<T> Clone for Chain<T>
where T: Clone,

Source§

fn clone(&self) -> Chain<T>

Returns a copy of the value. Read more
Source§

fn clone_from(&mut self, source: &Chain<T>)

Performs copy-assignment from source. Read more
Source§

impl<T> Default for Chain<T>
where T: Default,

Source§

fn default() -> Chain<T>

Returns the “default value” for a type. Read more
Source§

impl<T> Copy for Chain<T>
where T: Copy,

Auto Trait Implementations§

§

impl<T> Freeze for Chain<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Chain<T>
where T: RefUnwindSafe,

§

impl<T> Send for Chain<T>
where T: Send,

§

impl<T> Sync for Chain<T>
where T: Sync,

§

impl<T> Unpin for Chain<T>
where T: Unpin,

§

impl<T> UnwindSafe for Chain<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ChainInner for T

Source§

fn from_chain(chain: Chain<Self>) -> Self

Source§

fn into_chain(self) -> Chain<Self>

Source§

fn chain_mut(&mut self) -> Chain<&mut Self>

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> Encode for T

Source§

fn encode<E>(self) -> <E as Encoding>::EncodeOutput
where T: Encodable<E>, E: Encoding,

Source§

fn decode<E>(self) -> <E as Encoding>::DecodeOutput
where T: Decodable<E>, E: Encoding,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSelf for T

Source§

fn with_self(self, f: impl FnOnce(&mut Self)) -> Self

Takes ownership of the value, passing a mutable reference of it to a closure, then returning ownership of the value again