FoldChain

Struct FoldChain 

Source
pub struct FoldChain<T, D: Clone, Settings: FoldSettings<T, D>> { /* private fields */ }
Expand description

A base FoldChain. See FoldChain.

Implementations§

Source§

impl<T, D: Clone, Settings: FoldSettings<T, D>> FoldChain<T, (usize, D), SettingsWithSize<Settings>>

Source

pub fn as_fold_list(self) -> FoldList<T, D, Settings>

Convert a FoldChain that keeps track of size to a FoldList.

Source§

impl<T, D: Clone, OP: Fn(D, D) -> D + Copy, DeltaOf: Fn(&T) -> D + Copy, Empty: Fn() -> D + Copy> FoldChain<T, D, FoldSettingsStruct<T, D, TupleFun<OP>, DeltaOf, EmptyFn<Empty>>>

Source

pub fn new(op: OP, delta_of: DeltaOf, empty_delta_fn: Empty) -> Self

Create a new empty FoldChain, given the closures for Settings.

Source

pub fn from_iter( op: OP, delta_of: DeltaOf, empty_delta_fn: Empty, iter: impl Iterator<Item = T>, ) -> Self

Create a new FoldChain, given the closures for Settings, and fill it using an iterator, from left to right.

Source§

impl<T, D: Clone, OP: Fn(D, D) -> D + Copy, DeltaOf: Fn(&T) -> D + Copy> FoldChain<T, Option<D>, FoldSettingsStruct<T, Option<D>, OptOpFun<TupleFun<OP>>, SomeFun<DeltaOf>, NoneFun>>

Source

pub fn new_with_opt(op: OP, delta_of: DeltaOf) -> Self

Create a new empty FoldChain, given the closures for Settings, except the one for the empty delta, which will always be None.

The resulting delta type will be Option<D> instead of D.

Source

pub fn new_with_opt_from_iter( op: OP, delta_of: DeltaOf, iter: impl Iterator<Item = T>, ) -> Self

Create a new empty FoldChain, given the closures for Settings, except the one for the empty delta, which will always be None, and fill it using an iterator, from left to right.

The resulting delta type will be Option<D> instead of D.

Source§

impl<T, D: Clone, Settings: FoldSettings<T, D>> FoldChain<T, D, Settings>

Source

pub fn from_settings(settings: Settings) -> Self

Create a new empty FoldChain, with the specified Settings.

Source

pub fn get_current_simplification(&self)

Source

pub fn get_settings(&self) -> Settings

An alias of get_settings.

Source

pub fn as_imm( &self, ) -> ImmFoldChainSliceStruct<'_, False, True, True, Settings, (), T, D>

An alias of as_imm.

Source

pub fn borrow( &self, ) -> ImmFoldChainSliceStruct<'_, False, True, True, Settings, (), T, D>

An alias of borrow.

Source

pub fn view_drop_left_until( &self, predicate: impl Fn(&D) -> bool, ) -> ImmFoldChainSliceStruct<'_, False, False, True, Settings, (), T, D>

An alias of view_drop_left_until.

Source

pub fn view_take_right_until( &self, predicate: impl Fn(&D) -> bool, ) -> ImmFoldChainSliceStruct<'_, False, False, True, Settings, (), T, D>

An alias of view_take_right_until.

Source

pub fn view_drop_right_until( &self, predicate: impl Fn(&D) -> bool, ) -> ImmFoldChainSliceStruct<'_, False, True, False, Settings, (), T, D>

An alias of view_drop_right_until.

Source

pub fn view_take_left_until( &self, predicate: impl Fn(&D) -> bool, ) -> ImmFoldChainSliceStruct<'_, False, True, False, Settings, (), T, D>

An alias of view_take_left_until.

Source

pub fn view_drop<Predicate: Fn(&D) -> bool, Range: SingleEndedRange<Predicate>>( &self, range: Range, ) -> <<Range as SingleEndedRange<Predicate>>::EndIsLeft as Bool>::IfElse<ImmFoldChainSliceStruct<'_, False, True, False, Settings, (), T, D>, ImmFoldChainSliceStruct<'_, False, False, True, Settings, (), T, D>>

An alias of view_drop.

Source

pub fn view_take<Predicate: Fn(&D) -> bool, Range: SingleEndedRange<Predicate>>( &self, range: Range, ) -> <<Range as SingleEndedRange<Predicate>>::EndIsLeft as Bool>::IfElse<ImmFoldChainSliceStruct<'_, False, False, True, Settings, (), T, D>, ImmFoldChainSliceStruct<'_, False, True, False, Settings, (), T, D>>

An alias of view_take.

Source

pub fn view_reversed( &self, ) -> ImmFoldChainSliceStruct<'_, True, True, True, Settings, (), T, D>

An alias of view_reversed.

Source

pub fn view_with_simplification<NewSimplification: FoldSimplification<T, D>>( &self, new_simplification: NewSimplification, ) -> ImmFoldChainSliceStruct<'_, False, True, True, Settings, <NewSimplification as FoldSimplification<T, D>>::ComposeAfterOther<D, ()>, T, D>

Source

pub fn view_simplify<'a, D2: Clone + 'a, Simplifier: for<'x> Fun<&'x D, D2> + Copy + 'a, OP2: Fun<(D2, D2), D2> + Copy + 'a>( &'a self, simplifier: Simplifier, simplified_op: OP2, ) -> ImmFoldChainSliceStruct<'a, False, True, True, Settings, SimplificationWithoutShortcut<T, D, D2, Simplifier, OP2>, T, D>

An alias of view_simplify.

Source

pub fn view_simplify_with_shortcut<'a, D2: Clone + 'a, Simplifier: for<'x> Fun<&'x D, D2> + Copy + 'a, OP2: Fun<(D2, D2), D2> + Copy + 'a, EmptyShortcut: Fun<(), D2> + Copy + 'a, DeltaShortcut: for<'x> Fun<&'x T, D2> + Copy + 'a>( &'a self, simplifier: Simplifier, simplified_op: OP2, empty_shortcut: EmptyShortcut, delta_shortcut: DeltaShortcut, ) -> ImmFoldChainSliceStruct<'a, False, True, True, Settings, SimplificationWithShortcut<T, D, D2, Simplifier, OP2, EmptyShortcut, DeltaShortcut>, T, D>

Source

pub fn view_unsimplify( &self, ) -> ImmFoldChainSliceStruct<'_, False, True, True, Settings, (), T, D>

An alias of view_unsimplify.

Source

pub fn fold(&self) -> D

An alias of fold.

Source

pub fn is_empty(&self) -> bool

An alias of is_empty.

Source

pub fn left<'b>(&'b self) -> Option<&'b T>

An alias of left.

Source

pub fn right<'b>(&'b self) -> Option<&'b T>

An alias of right.

Source

pub fn foreach(&self, f: impl FnMut(&T))

An alias of foreach.

Source

pub fn iter<'b>(&'b self) -> Iter<'b, False, T, D>

An alias of iter.

Source

pub fn as_mut( &mut self, ) -> MutFoldChainSliceStruct<'_, False, True, True, T, D, Settings, ()>

An alias of as_mut.

Source

pub fn borrow_mut( &mut self, ) -> MutFoldChainSliceStruct<'_, False, True, True, T, D, Settings, ()>

An alias of borrow_mut.

Source

pub fn mut_view_drop_left_until( &mut self, predicate: impl Fn(&D) -> bool, ) -> MutFoldChainSliceStruct<'_, False, False, True, T, D, Settings, ()>

Source

pub fn mut_view_take_right_until( &mut self, predicate: impl Fn(&D) -> bool, ) -> MutFoldChainSliceStruct<'_, False, False, True, T, D, Settings, ()>

Source

pub fn mut_view_drop_right_until( &mut self, predicate: impl Fn(&D) -> bool, ) -> MutFoldChainSliceStruct<'_, False, True, False, T, D, Settings, ()>

Source

pub fn mut_view_take_left_until( &mut self, predicate: impl Fn(&D) -> bool, ) -> MutFoldChainSliceStruct<'_, False, True, False, T, D, Settings, ()>

Source

pub fn mut_view_drop<Predicate: Fn(&D) -> bool, Range: SingleEndedRange<Predicate>>( &mut self, range: Range, ) -> <<Range as SingleEndedRange<Predicate>>::EndIsLeft as Bool>::IfElse<MutFoldChainSliceStruct<'_, False, True, False, T, D, Settings, ()>, MutFoldChainSliceStruct<'_, False, False, True, T, D, Settings, ()>>

An alias of mut_view_drop.

Source

pub fn mut_view_take<Predicate: Fn(&D) -> bool, Range: SingleEndedRange<Predicate>>( &mut self, range: Range, ) -> <<Range as SingleEndedRange<Predicate>>::EndIsLeft as Bool>::IfElse<MutFoldChainSliceStruct<'_, False, False, True, T, D, Settings, ()>, MutFoldChainSliceStruct<'_, False, True, False, T, D, Settings, ()>>

An alias of mut_view_take.

Source

pub fn mut_view_reversed( &mut self, ) -> MutFoldChainSliceStruct<'_, True, True, True, T, D, Settings, ()>

An alias of mut_view_reversed.

Source

pub fn mut_view_with_simplification<NewSimplification: FoldSimplification<T, D>>( &mut self, new_simplification: NewSimplification, ) -> MutFoldChainSliceStruct<'_, False, True, True, T, D, Settings, <NewSimplification as FoldSimplification<T, D>>::ComposeAfterOther<D, ()>>

Source

pub fn mut_view_simplify<'a, D2: Clone + 'a, Simplifier: for<'x> Fun<&'x D, D2> + Copy + 'a, OP2: Fun<(D2, D2), D2> + Copy + 'a>( &'a mut self, simplifier: Simplifier, simplified_op: OP2, ) -> MutFoldChainSliceStruct<'a, False, True, True, T, D, Settings, SimplificationWithoutShortcut<T, D, D2, Simplifier, OP2>>

An alias of mut_view_simplify.

Source

pub fn mut_view_simplify_with_shortcut<'a, D2: Clone + 'a, Simplifier: for<'x> Fun<&'x D, D2> + Copy + 'a, OP2: Fun<(D2, D2), D2> + Copy + 'a, EmptyShortcut: Fun<(), D2> + Copy + 'a, DeltaShortcut: for<'x> Fun<&'x T, D2> + Copy + 'a>( &'a mut self, simplifier: Simplifier, simplified_op: OP2, empty_shortcut: EmptyShortcut, delta_shortcut: DeltaShortcut, ) -> MutFoldChainSliceStruct<'a, False, True, True, T, D, Settings, SimplificationWithShortcut<T, D, D2, Simplifier, OP2, EmptyShortcut, DeltaShortcut>>

Source

pub fn mut_view_unsimplify( &mut self, ) -> MutFoldChainSliceStruct<'_, False, True, True, T, D, Settings, ()>

An alias of mut_view_unsimplify.

Source

pub fn pop_left(&mut self) -> Option<T>

An alias of pop_left.

Source

pub fn pop_right(&mut self) -> Option<T>

An alias of pop_right.

Source

pub fn append_left(&mut self, value: T)

An alias of append_left.

Source

pub fn append_right(&mut self, value: T)

An alias of append_right.

Source

pub fn set_left_or_err(&mut self, value: T) -> Result<T, T>

An alias of set_left_or_err.

Source

pub fn set_right_or_err(&mut self, value: T) -> Result<T, T>

An alias of set_right_or_err.

Source

pub fn set_left(&mut self, value: T) -> T

An alias of set_left.

Source

pub fn set_right(&mut self, value: T) -> T

An alias of set_right.

Source

pub fn update_left<R>(&mut self, f: impl FnOnce(Option<&mut T>) -> R) -> R

An alias of update_left.

Source

pub fn update_right<R>(&mut self, f: impl FnOnce(Option<&mut T>) -> R) -> R

An alias of update_right.

Source

pub fn foreach_mut(&mut self, f: impl FnMut(&mut T))

An alias of foreach_mut.

Source

pub fn take_all(&mut self) -> FoldChain<T, D, Settings>

An alias of take_all.

Source

pub fn append_all_right(&mut self, chain: FoldChain<T, D, Settings>)

An alias of append_all_right.

Source

pub fn append_all_left(&mut self, chain: FoldChain<T, D, Settings>)

An alias of append_all_left.

Source

pub fn append_left_from_iter(&mut self, iter: impl Iterator<Item = T>)

An alias of append_left_from_iter.

Source

pub fn append_right_from_iter(&mut self, iter: impl Iterator<Item = T>)

Trait Implementations§

Source§

impl<T: Clone, D: Clone, Settings: FoldSettings<T, D>> Clone for FoldChain<T, D, Settings>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug, D: Clone, Settings: FoldSettings<T, D>> Debug for FoldChain<T, D, Settings>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a, T, D: Clone, Settings: FoldSettings<T, D>> FoldChainSlice<'a, T, D> for &'a FoldChain<T, D, Settings>

Source§

type OriginalD = D

The D type of the base FoldChain. May differ from this D if a simplification has been applied.
Source§

type IsReversed = False

A type-level boolean indicating whether this view has been reversed an odd number of times
Source§

type IsFlushLeft = True

A type-level boolean indicating whether this view necessarily shares the base FoldChain’s left endpoint
Source§

type IsFlushRight = True

A type-level boolean indicating whether this view necessarily shares the base FoldChain’s right endpoint
Source§

type Simplification = ()

The type of the current simplification
Source§

type Settings = Settings

The type of the base FoldChain’s settings.
Source§

fn get_settings(&self) -> Self::Settings

Get a copy of the base FoldChain’s settings.
Source§

fn get_current_simplification(&self) -> Self::Simplification

Get a copy of the current simplification. Will be () if no simplification has been applied.
Source§

fn as_imm( self, ) -> ImmFoldChainSliceStruct<'a, Self::IsReversed, Self::IsFlushLeft, Self::IsFlushRight, Self::Settings, Self::Simplification, T, Self::OriginalD>

Make this view immutable.
Source§

fn borrow<'b>( &'b self, ) -> ImmFoldChainSliceStruct<'b, Self::IsReversed, Self::IsFlushLeft, Self::IsFlushRight, Self::Settings, Self::Simplification, T, Self::OriginalD>

Immutably borrow this view.
Source§

fn debug_check_structural_integrity(&self) -> bool

debug_assert! that the backing data structure is in a valid state. You should never have to use this.
Source§

fn view_drop_left_until( self, predicate: impl Fn(&D) -> bool, ) -> ImmFoldChainSliceStruct<'a, Self::IsReversed, <Self::IsFlushLeft as Bool>::And<Self::IsReversed>, <Self::IsFlushRight as Bool>::And<<Self::IsReversed as Bool>::Not>, Self::Settings, Self::Simplification, T, Self::OriginalD>

Contract this view on the left while the to-be-discarded range’s fold doesn’t meet predicate. Read more
Source§

fn view_take_right_until( self, predicate: impl Fn(&D) -> bool, ) -> ImmFoldChainSliceStruct<'a, Self::IsReversed, <Self::IsFlushLeft as Bool>::And<Self::IsReversed>, <Self::IsFlushRight as Bool>::And<<Self::IsReversed as Bool>::Not>, Self::Settings, Self::Simplification, T, Self::OriginalD>

Restrict this view to the longest range that starts on the right and whose fold doesn’t meet predicate. Read more
Source§

fn view_drop_right_until( self, predicate: impl Fn(&D) -> bool, ) -> ImmFoldChainSliceStruct<'a, <<Self::IsReversed as Bool>::Not as Bool>::Not, <Self::IsFlushLeft as Bool>::And<<Self::IsReversed as Bool>::Not>, <Self::IsFlushRight as Bool>::And<<<Self::IsReversed as Bool>::Not as Bool>::Not>, Self::Settings, Self::Simplification, T, Self::OriginalD>

Contract this view on the right while the to-be-discarded range’s fold doesn’t meet predicate. Read more
Source§

fn view_take_left_until( self, predicate: impl Fn(&D) -> bool, ) -> ImmFoldChainSliceStruct<'a, <<Self::IsReversed as Bool>::Not as Bool>::Not, <Self::IsFlushLeft as Bool>::And<<Self::IsReversed as Bool>::Not>, <Self::IsFlushRight as Bool>::And<<<Self::IsReversed as Bool>::Not as Bool>::Not>, Self::Settings, Self::Simplification, T, Self::OriginalD>

Restrict this view to the longest range that starts on the left and whose fold doesn’t meet predicate. Read more
Source§

fn view_drop<Predicate: Fn(&D) -> bool, Range: SingleEndedRange<Predicate>>( self, range: Range, ) -> <<Range as SingleEndedRange<Predicate>>::EndIsLeft as Bool>::IfElse<ImmFoldChainSliceStruct<'a, <<<Self as FoldChainSlice<'a, T, D>>::IsReversed as Bool>::Not as Bool>::Not, <<Self as FoldChainSlice<'a, T, D>>::IsFlushLeft as Bool>::And<<<Self as FoldChainSlice<'a, T, D>>::IsReversed as Bool>::Not>, <<Self as FoldChainSlice<'a, T, D>>::IsFlushRight as Bool>::And<<<<Self as FoldChainSlice<'a, T, D>>::IsReversed as Bool>::Not as Bool>::Not>, <Self as FoldChainSlice<'a, T, D>>::Settings, <Self as FoldChainSlice<'a, T, D>>::Simplification, T, <Self as FoldChainSlice<'a, T, D>>::OriginalD>, ImmFoldChainSliceStruct<'a, <Self as FoldChainSlice<'a, T, D>>::IsReversed, <<Self as FoldChainSlice<'a, T, D>>::IsFlushLeft as Bool>::And<<Self as FoldChainSlice<'a, T, D>>::IsReversed>, <<Self as FoldChainSlice<'a, T, D>>::IsFlushRight as Bool>::And<<<Self as FoldChainSlice<'a, T, D>>::IsReversed as Bool>::Not>, <Self as FoldChainSlice<'a, T, D>>::Settings, <Self as FoldChainSlice<'a, T, D>>::Simplification, T, <Self as FoldChainSlice<'a, T, D>>::OriginalD>>

If range is ..predicate, calls view_drop_left_until(predicate). Read more
Source§

fn view_take<Predicate: Fn(&D) -> bool, Range: SingleEndedRange<Predicate>>( self, range: Range, ) -> <<Range as SingleEndedRange<Predicate>>::EndIsLeft as Bool>::IfElse<ImmFoldChainSliceStruct<'a, <Self as FoldChainSlice<'a, T, D>>::IsReversed, <<Self as FoldChainSlice<'a, T, D>>::IsFlushLeft as Bool>::And<<Self as FoldChainSlice<'a, T, D>>::IsReversed>, <<Self as FoldChainSlice<'a, T, D>>::IsFlushRight as Bool>::And<<<Self as FoldChainSlice<'a, T, D>>::IsReversed as Bool>::Not>, <Self as FoldChainSlice<'a, T, D>>::Settings, <Self as FoldChainSlice<'a, T, D>>::Simplification, T, <Self as FoldChainSlice<'a, T, D>>::OriginalD>, ImmFoldChainSliceStruct<'a, <<<Self as FoldChainSlice<'a, T, D>>::IsReversed as Bool>::Not as Bool>::Not, <<Self as FoldChainSlice<'a, T, D>>::IsFlushLeft as Bool>::And<<<Self as FoldChainSlice<'a, T, D>>::IsReversed as Bool>::Not>, <<Self as FoldChainSlice<'a, T, D>>::IsFlushRight as Bool>::And<<<<Self as FoldChainSlice<'a, T, D>>::IsReversed as Bool>::Not as Bool>::Not>, <Self as FoldChainSlice<'a, T, D>>::Settings, <Self as FoldChainSlice<'a, T, D>>::Simplification, T, <Self as FoldChainSlice<'a, T, D>>::OriginalD>>

If range is ..predicate, calls view_take_left_until(predicate). Read more
Source§

fn view_reversed( self, ) -> ImmFoldChainSliceStruct<'a, <Self::IsReversed as Bool>::Not, Self::IsFlushLeft, Self::IsFlushRight, Self::Settings, Self::Simplification, T, Self::OriginalD>

Get a reversed version of this view. See Reverse. Read more
Source§

fn view_with_simplification<NewSimplification: FoldSimplification<T, D>>( self, new_simplification: NewSimplification, ) -> ImmFoldChainSliceStruct<'a, Self::IsReversed, Self::IsFlushLeft, Self::IsFlushRight, Self::Settings, NewSimplification::ComposeAfterOther<Self::OriginalD, Self::Simplification>, T, Self::OriginalD>

Compose this view’s current simplification with another one explicitly. See Simplification. Read more
Source§

fn view_simplify<D2: Clone + 'a, Simplifier: for<'x> Fun<&'x D, D2> + Copy + 'a, OP2: Fun<(D2, D2), D2> + Copy + 'a>( self, simplifier: Simplifier, simplified_op: OP2, ) -> ImmFoldChainSliceStruct<'a, Self::IsReversed, Self::IsFlushLeft, Self::IsFlushRight, Self::Settings, <Self::Simplification as FoldSimplification<T, Self::OriginalD>>::Compose<D2, Simplifier, OP2>, T, Self::OriginalD>

Simplify this view. See Simplification. Read more
Source§

fn view_simplify_with_shortcut<D2: Clone + 'a, Simplifier: for<'x> Fun<&'x D, D2> + Copy + 'a, OP2: Fun<(D2, D2), D2> + Copy + 'a, EmptyShortcut: Fun<(), D2> + Copy + 'a, DeltaShortcut: for<'x> Fun<&'x T, D2> + Copy + 'a>( self, simplifier: Simplifier, simplified_op: OP2, empty_shortcut: EmptyShortcut, delta_shortcut: DeltaShortcut, ) -> ImmFoldChainSliceStruct<'a, Self::IsReversed, Self::IsFlushLeft, Self::IsFlushRight, Self::Settings, <Self::Simplification as FoldSimplification<T, Self::OriginalD>>::ComposeWithShortcut<D2, Simplifier, OP2, EmptyShortcut, DeltaShortcut>, T, Self::OriginalD>

Simplify this view in a possibly more efficient way. See Simplification. Read more
Source§

fn view_unsimplify( self, ) -> ImmFoldChainSliceStruct<'a, Self::IsReversed, Self::IsFlushLeft, Self::IsFlushRight, Self::Settings, (), T, Self::OriginalD>

Remove all simplifications that were applied to this view. See Simplification. Read more
Source§

fn fold(&self) -> D

Get this slice’s fold. Read more
Source§

fn is_empty(&self) -> bool

Returns true if this slice is empty (that is, when it contains 0 elements). Read more
Source§

fn left<'b>(&'b self) -> Option<&'b T>
where 'a: 'b,

Get an immutable reference to this slice’s leftmost element, if this slice is not empty. Read more
Source§

fn right<'b>(&'b self) -> Option<&'b T>
where 'a: 'b,

Get an immutable reference to this slice’s rightmost element, if this slice is not empty. Read more
Source§

fn foreach(&self, f: impl FnMut(&T))

Run a closure for each of this slice’s elements, from left to right. Read more
Source§

fn iter<'b>(&'b self) -> Iter<'b, Self::IsReversed, T, Self::OriginalD>
where 'a: 'b,

Get an iterator over immutable references to this slice’s elements, from left to right. Read more
Source§

impl<'a, T, D: Clone, Settings: FoldSettings<T, D>> FoldChainSlice<'a, T, D> for &'a mut FoldChain<T, D, Settings>

Source§

type OriginalD = D

The D type of the base FoldChain. May differ from this D if a simplification has been applied.
Source§

type IsReversed = False

A type-level boolean indicating whether this view has been reversed an odd number of times
Source§

type IsFlushLeft = True

A type-level boolean indicating whether this view necessarily shares the base FoldChain’s left endpoint
Source§

type IsFlushRight = True

A type-level boolean indicating whether this view necessarily shares the base FoldChain’s right endpoint
Source§

type Simplification = ()

The type of the current simplification
Source§

type Settings = Settings

The type of the base FoldChain’s settings.
Source§

fn get_settings(&self) -> Self::Settings

Get a copy of the base FoldChain’s settings.
Source§

fn get_current_simplification(&self) -> Self::Simplification

Get a copy of the current simplification. Will be () if no simplification has been applied.
Source§

fn as_imm( self, ) -> ImmFoldChainSliceStruct<'a, Self::IsReversed, Self::IsFlushLeft, Self::IsFlushRight, Self::Settings, Self::Simplification, T, Self::OriginalD>

Make this view immutable.
Source§

fn borrow<'b>( &'b self, ) -> ImmFoldChainSliceStruct<'b, Self::IsReversed, Self::IsFlushLeft, Self::IsFlushRight, Self::Settings, Self::Simplification, T, Self::OriginalD>

Immutably borrow this view.
Source§

fn debug_check_structural_integrity(&self) -> bool

debug_assert! that the backing data structure is in a valid state. You should never have to use this.
Source§

fn view_drop_left_until( self, predicate: impl Fn(&D) -> bool, ) -> ImmFoldChainSliceStruct<'a, Self::IsReversed, <Self::IsFlushLeft as Bool>::And<Self::IsReversed>, <Self::IsFlushRight as Bool>::And<<Self::IsReversed as Bool>::Not>, Self::Settings, Self::Simplification, T, Self::OriginalD>

Contract this view on the left while the to-be-discarded range’s fold doesn’t meet predicate. Read more
Source§

fn view_take_right_until( self, predicate: impl Fn(&D) -> bool, ) -> ImmFoldChainSliceStruct<'a, Self::IsReversed, <Self::IsFlushLeft as Bool>::And<Self::IsReversed>, <Self::IsFlushRight as Bool>::And<<Self::IsReversed as Bool>::Not>, Self::Settings, Self::Simplification, T, Self::OriginalD>

Restrict this view to the longest range that starts on the right and whose fold doesn’t meet predicate. Read more
Source§

fn view_drop_right_until( self, predicate: impl Fn(&D) -> bool, ) -> ImmFoldChainSliceStruct<'a, <<Self::IsReversed as Bool>::Not as Bool>::Not, <Self::IsFlushLeft as Bool>::And<<Self::IsReversed as Bool>::Not>, <Self::IsFlushRight as Bool>::And<<<Self::IsReversed as Bool>::Not as Bool>::Not>, Self::Settings, Self::Simplification, T, Self::OriginalD>

Contract this view on the right while the to-be-discarded range’s fold doesn’t meet predicate. Read more
Source§

fn view_take_left_until( self, predicate: impl Fn(&D) -> bool, ) -> ImmFoldChainSliceStruct<'a, <<Self::IsReversed as Bool>::Not as Bool>::Not, <Self::IsFlushLeft as Bool>::And<<Self::IsReversed as Bool>::Not>, <Self::IsFlushRight as Bool>::And<<<Self::IsReversed as Bool>::Not as Bool>::Not>, Self::Settings, Self::Simplification, T, Self::OriginalD>

Restrict this view to the longest range that starts on the left and whose fold doesn’t meet predicate. Read more
Source§

fn view_drop<Predicate: Fn(&D) -> bool, Range: SingleEndedRange<Predicate>>( self, range: Range, ) -> <<Range as SingleEndedRange<Predicate>>::EndIsLeft as Bool>::IfElse<ImmFoldChainSliceStruct<'a, <<<Self as FoldChainSlice<'a, T, D>>::IsReversed as Bool>::Not as Bool>::Not, <<Self as FoldChainSlice<'a, T, D>>::IsFlushLeft as Bool>::And<<<Self as FoldChainSlice<'a, T, D>>::IsReversed as Bool>::Not>, <<Self as FoldChainSlice<'a, T, D>>::IsFlushRight as Bool>::And<<<<Self as FoldChainSlice<'a, T, D>>::IsReversed as Bool>::Not as Bool>::Not>, <Self as FoldChainSlice<'a, T, D>>::Settings, <Self as FoldChainSlice<'a, T, D>>::Simplification, T, <Self as FoldChainSlice<'a, T, D>>::OriginalD>, ImmFoldChainSliceStruct<'a, <Self as FoldChainSlice<'a, T, D>>::IsReversed, <<Self as FoldChainSlice<'a, T, D>>::IsFlushLeft as Bool>::And<<Self as FoldChainSlice<'a, T, D>>::IsReversed>, <<Self as FoldChainSlice<'a, T, D>>::IsFlushRight as Bool>::And<<<Self as FoldChainSlice<'a, T, D>>::IsReversed as Bool>::Not>, <Self as FoldChainSlice<'a, T, D>>::Settings, <Self as FoldChainSlice<'a, T, D>>::Simplification, T, <Self as FoldChainSlice<'a, T, D>>::OriginalD>>

If range is ..predicate, calls view_drop_left_until(predicate). Read more
Source§

fn view_take<Predicate: Fn(&D) -> bool, Range: SingleEndedRange<Predicate>>( self, range: Range, ) -> <<Range as SingleEndedRange<Predicate>>::EndIsLeft as Bool>::IfElse<ImmFoldChainSliceStruct<'a, <Self as FoldChainSlice<'a, T, D>>::IsReversed, <<Self as FoldChainSlice<'a, T, D>>::IsFlushLeft as Bool>::And<<Self as FoldChainSlice<'a, T, D>>::IsReversed>, <<Self as FoldChainSlice<'a, T, D>>::IsFlushRight as Bool>::And<<<Self as FoldChainSlice<'a, T, D>>::IsReversed as Bool>::Not>, <Self as FoldChainSlice<'a, T, D>>::Settings, <Self as FoldChainSlice<'a, T, D>>::Simplification, T, <Self as FoldChainSlice<'a, T, D>>::OriginalD>, ImmFoldChainSliceStruct<'a, <<<Self as FoldChainSlice<'a, T, D>>::IsReversed as Bool>::Not as Bool>::Not, <<Self as FoldChainSlice<'a, T, D>>::IsFlushLeft as Bool>::And<<<Self as FoldChainSlice<'a, T, D>>::IsReversed as Bool>::Not>, <<Self as FoldChainSlice<'a, T, D>>::IsFlushRight as Bool>::And<<<<Self as FoldChainSlice<'a, T, D>>::IsReversed as Bool>::Not as Bool>::Not>, <Self as FoldChainSlice<'a, T, D>>::Settings, <Self as FoldChainSlice<'a, T, D>>::Simplification, T, <Self as FoldChainSlice<'a, T, D>>::OriginalD>>

If range is ..predicate, calls view_take_left_until(predicate). Read more
Source§

fn view_reversed( self, ) -> ImmFoldChainSliceStruct<'a, <Self::IsReversed as Bool>::Not, Self::IsFlushLeft, Self::IsFlushRight, Self::Settings, Self::Simplification, T, Self::OriginalD>

Get a reversed version of this view. See Reverse. Read more
Source§

fn view_with_simplification<NewSimplification: FoldSimplification<T, D>>( self, new_simplification: NewSimplification, ) -> ImmFoldChainSliceStruct<'a, Self::IsReversed, Self::IsFlushLeft, Self::IsFlushRight, Self::Settings, NewSimplification::ComposeAfterOther<Self::OriginalD, Self::Simplification>, T, Self::OriginalD>

Compose this view’s current simplification with another one explicitly. See Simplification. Read more
Source§

fn view_simplify<D2: Clone + 'a, Simplifier: for<'x> Fun<&'x D, D2> + Copy + 'a, OP2: Fun<(D2, D2), D2> + Copy + 'a>( self, simplifier: Simplifier, simplified_op: OP2, ) -> ImmFoldChainSliceStruct<'a, Self::IsReversed, Self::IsFlushLeft, Self::IsFlushRight, Self::Settings, <Self::Simplification as FoldSimplification<T, Self::OriginalD>>::Compose<D2, Simplifier, OP2>, T, Self::OriginalD>

Simplify this view. See Simplification. Read more
Source§

fn view_simplify_with_shortcut<D2: Clone + 'a, Simplifier: for<'x> Fun<&'x D, D2> + Copy + 'a, OP2: Fun<(D2, D2), D2> + Copy + 'a, EmptyShortcut: Fun<(), D2> + Copy + 'a, DeltaShortcut: for<'x> Fun<&'x T, D2> + Copy + 'a>( self, simplifier: Simplifier, simplified_op: OP2, empty_shortcut: EmptyShortcut, delta_shortcut: DeltaShortcut, ) -> ImmFoldChainSliceStruct<'a, Self::IsReversed, Self::IsFlushLeft, Self::IsFlushRight, Self::Settings, <Self::Simplification as FoldSimplification<T, Self::OriginalD>>::ComposeWithShortcut<D2, Simplifier, OP2, EmptyShortcut, DeltaShortcut>, T, Self::OriginalD>

Simplify this view in a possibly more efficient way. See Simplification. Read more
Source§

fn view_unsimplify( self, ) -> ImmFoldChainSliceStruct<'a, Self::IsReversed, Self::IsFlushLeft, Self::IsFlushRight, Self::Settings, (), T, Self::OriginalD>

Remove all simplifications that were applied to this view. See Simplification. Read more
Source§

fn fold(&self) -> D

Get this slice’s fold. Read more
Source§

fn is_empty(&self) -> bool

Returns true if this slice is empty (that is, when it contains 0 elements). Read more
Source§

fn left<'b>(&'b self) -> Option<&'b T>
where 'a: 'b,

Get an immutable reference to this slice’s leftmost element, if this slice is not empty. Read more
Source§

fn right<'b>(&'b self) -> Option<&'b T>
where 'a: 'b,

Get an immutable reference to this slice’s rightmost element, if this slice is not empty. Read more
Source§

fn foreach(&self, f: impl FnMut(&T))

Run a closure for each of this slice’s elements, from left to right. Read more
Source§

fn iter<'b>(&'b self) -> Iter<'b, Self::IsReversed, T, Self::OriginalD>
where 'a: 'b,

Get an iterator over immutable references to this slice’s elements, from left to right. Read more
Source§

impl<'a, T, D: Clone, Settings: FoldSettings<T, D>> IntoIterator for &'a FoldChain<T, D, Settings>

Source§

type Item = &'a T

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, False, T, D>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T, D: Clone, Settings: FoldSettings<T, D>> IntoIterator for FoldChain<T, D, Settings>

Source§

type Item = T

The type of the elements being iterated over.
Source§

type IntoIter = DrainOwned<T, D, Settings>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, T, D: Clone, Settings: FoldSettings<T, D>> MutFoldChainSlice<'a, T, D> for &'a mut FoldChain<T, D, Settings>

Source§

fn as_mut( self, ) -> MutFoldChainSliceStruct<'a, Self::IsReversed, Self::IsFlushLeft, Self::IsFlushRight, T, Self::OriginalD, Self::Settings, Self::Simplification>

Normalize this view’s type. This is mostly useless.
Source§

fn borrow_mut<'b>( &'b mut self, ) -> MutFoldChainSliceStruct<'b, Self::IsReversed, Self::IsFlushLeft, Self::IsFlushRight, T, Self::OriginalD, Self::Settings, Self::Simplification>

Mutably borrow this view.
Source§

fn mut_view_drop_left_until( self, predicate: impl Fn(&D) -> bool, ) -> MutFoldChainSliceStruct<'a, Self::IsReversed, <Self::IsFlushLeft as Bool>::And<Self::IsReversed>, <Self::IsFlushRight as Bool>::And<<Self::IsReversed as Bool>::Not>, T, Self::OriginalD, Self::Settings, Self::Simplification>

Contract this view on the left while the to-be-discarded range’s fold doesn’t meet predicate. Read more
Source§

fn mut_view_take_right_until( self, predicate: impl Fn(&D) -> bool, ) -> MutFoldChainSliceStruct<'a, Self::IsReversed, <Self::IsFlushLeft as Bool>::And<Self::IsReversed>, <Self::IsFlushRight as Bool>::And<<Self::IsReversed as Bool>::Not>, T, Self::OriginalD, Self::Settings, Self::Simplification>

Restrict this view to the longest range that starts on the right and whose fold doesn’t meet predicate. Read more
Source§

fn mut_view_drop_right_until( self, predicate: impl Fn(&D) -> bool, ) -> MutFoldChainSliceStruct<'a, <<Self::IsReversed as Bool>::Not as Bool>::Not, <Self::IsFlushLeft as Bool>::And<<Self::IsReversed as Bool>::Not>, <Self::IsFlushRight as Bool>::And<<<Self::IsReversed as Bool>::Not as Bool>::Not>, T, Self::OriginalD, Self::Settings, Self::Simplification>

Contract this view on the right while the to-be-discarded range’s fold doesn’t meet predicate. Read more
Source§

fn mut_view_take_left_until( self, predicate: impl Fn(&D) -> bool, ) -> MutFoldChainSliceStruct<'a, <<Self::IsReversed as Bool>::Not as Bool>::Not, <Self::IsFlushLeft as Bool>::And<<Self::IsReversed as Bool>::Not>, <Self::IsFlushRight as Bool>::And<<<Self::IsReversed as Bool>::Not as Bool>::Not>, T, Self::OriginalD, Self::Settings, Self::Simplification>

Restrict this view to the longest range that starts on the left and whose fold doesn’t meet predicate. Read more
Source§

fn mut_view_drop<Predicate: Fn(&D) -> bool, Range: SingleEndedRange<Predicate>>( self, range: Range, ) -> <<Range as SingleEndedRange<Predicate>>::EndIsLeft as Bool>::IfElse<MutFoldChainSliceStruct<'a, <<<Self as FoldChainSlice<'a, T, D>>::IsReversed as Bool>::Not as Bool>::Not, <<Self as FoldChainSlice<'a, T, D>>::IsFlushLeft as Bool>::And<<<Self as FoldChainSlice<'a, T, D>>::IsReversed as Bool>::Not>, <<Self as FoldChainSlice<'a, T, D>>::IsFlushRight as Bool>::And<<<<Self as FoldChainSlice<'a, T, D>>::IsReversed as Bool>::Not as Bool>::Not>, T, <Self as FoldChainSlice<'a, T, D>>::OriginalD, <Self as FoldChainSlice<'a, T, D>>::Settings, <Self as FoldChainSlice<'a, T, D>>::Simplification>, MutFoldChainSliceStruct<'a, <Self as FoldChainSlice<'a, T, D>>::IsReversed, <<Self as FoldChainSlice<'a, T, D>>::IsFlushLeft as Bool>::And<<Self as FoldChainSlice<'a, T, D>>::IsReversed>, <<Self as FoldChainSlice<'a, T, D>>::IsFlushRight as Bool>::And<<<Self as FoldChainSlice<'a, T, D>>::IsReversed as Bool>::Not>, T, <Self as FoldChainSlice<'a, T, D>>::OriginalD, <Self as FoldChainSlice<'a, T, D>>::Settings, <Self as FoldChainSlice<'a, T, D>>::Simplification>>

If range is ..predicate, calls mut_view_drop_left_until(predicate). Read more
Source§

fn mut_view_take<Predicate: Fn(&D) -> bool, Range: SingleEndedRange<Predicate>>( self, range: Range, ) -> <<Range as SingleEndedRange<Predicate>>::EndIsLeft as Bool>::IfElse<MutFoldChainSliceStruct<'a, <Self as FoldChainSlice<'a, T, D>>::IsReversed, <<Self as FoldChainSlice<'a, T, D>>::IsFlushLeft as Bool>::And<<Self as FoldChainSlice<'a, T, D>>::IsReversed>, <<Self as FoldChainSlice<'a, T, D>>::IsFlushRight as Bool>::And<<<Self as FoldChainSlice<'a, T, D>>::IsReversed as Bool>::Not>, T, <Self as FoldChainSlice<'a, T, D>>::OriginalD, <Self as FoldChainSlice<'a, T, D>>::Settings, <Self as FoldChainSlice<'a, T, D>>::Simplification>, MutFoldChainSliceStruct<'a, <<<Self as FoldChainSlice<'a, T, D>>::IsReversed as Bool>::Not as Bool>::Not, <<Self as FoldChainSlice<'a, T, D>>::IsFlushLeft as Bool>::And<<<Self as FoldChainSlice<'a, T, D>>::IsReversed as Bool>::Not>, <<Self as FoldChainSlice<'a, T, D>>::IsFlushRight as Bool>::And<<<<Self as FoldChainSlice<'a, T, D>>::IsReversed as Bool>::Not as Bool>::Not>, T, <Self as FoldChainSlice<'a, T, D>>::OriginalD, <Self as FoldChainSlice<'a, T, D>>::Settings, <Self as FoldChainSlice<'a, T, D>>::Simplification>>

If range is ..predicate, calls mut_view_take_left_until(predicate). Read more
Source§

fn mut_view_reversed( self, ) -> MutFoldChainSliceStruct<'a, <Self::IsReversed as Bool>::Not, Self::IsFlushLeft, Self::IsFlushRight, T, Self::OriginalD, Self::Settings, Self::Simplification>

Get a reversed version of this view. See Reverse. Read more
Source§

fn mut_view_with_simplification<NewSimplification: FoldSimplification<T, D>>( self, new_simplification: NewSimplification, ) -> MutFoldChainSliceStruct<'a, Self::IsReversed, Self::IsFlushLeft, Self::IsFlushRight, T, Self::OriginalD, Self::Settings, NewSimplification::ComposeAfterOther<Self::OriginalD, Self::Simplification>>

Compose this view’s current simplification with another one explicitly. See Simplification. Read more
Source§

fn mut_view_simplify<D2: Clone + 'a, Simplifier: for<'x> Fun<&'x D, D2> + Copy + 'a, OP2: Fun<(D2, D2), D2> + Copy + 'a>( self, simplifier: Simplifier, simplified_op: OP2, ) -> MutFoldChainSliceStruct<'a, Self::IsReversed, Self::IsFlushLeft, Self::IsFlushRight, T, Self::OriginalD, Self::Settings, <Self::Simplification as FoldSimplification<T, Self::OriginalD>>::Compose<D2, Simplifier, OP2>>

Simplify this view. See Simplification. Read more
Source§

fn mut_view_simplify_with_shortcut<D2: Clone + 'a, Simplifier: for<'x> Fun<&'x D, D2> + Copy + 'a, OP2: Fun<(D2, D2), D2> + Copy + 'a, EmptyShortcut: Fun<(), D2> + Copy + 'a, DeltaShortcut: for<'x> Fun<&'x T, D2> + Copy + 'a>( self, simplifier: Simplifier, simplified_op: OP2, empty_shortcut: EmptyShortcut, delta_shortcut: DeltaShortcut, ) -> MutFoldChainSliceStruct<'a, Self::IsReversed, Self::IsFlushLeft, Self::IsFlushRight, T, Self::OriginalD, Self::Settings, <Self::Simplification as FoldSimplification<T, Self::OriginalD>>::ComposeWithShortcut<D2, Simplifier, OP2, EmptyShortcut, DeltaShortcut>>

Simplify this view in a possibly more efficient way. See Simplification. Read more
Source§

fn mut_view_unsimplify( self, ) -> MutFoldChainSliceStruct<'a, Self::IsReversed, Self::IsFlushLeft, Self::IsFlushRight, T, Self::OriginalD, Self::Settings, ()>

Remove all simplifications that were applied to this view. See Simplification. Read more
Source§

fn pop_left(&mut self) -> Option<T>

Remove the leftmost element from this slice. Read more
Source§

fn pop_right(&mut self) -> Option<T>

Remove the rightmost element from this slice. Read more
Source§

fn append_left(&mut self, value: T)

Append value to the left of this slice.
Source§

fn append_right(&mut self, value: T)

Append value to the right of this slice.
Source§

fn set_left_or_err(&mut self, value: T) -> Result<T, T>

Replace the leftmost element of this slice with value. Read more
Source§

fn set_right_or_err(&mut self, value: T) -> Result<T, T>

Replace the rightmost element of this slice with value. Read more
Source§

fn set_left(&mut self, value: T) -> T

Replace the leftmost element of this slice with value and return its previous value. Read more
Source§

fn set_right(&mut self, value: T) -> T

Replace the rightmost element of this slice with value and return its previous value. Read more
Source§

fn update_left<R>(&mut self, f: impl FnOnce(Option<&mut T>) -> R) -> R

Mutate the leftmost element of this slice via a closure, and return the result of the closure. Read more
Source§

fn update_right<R>(&mut self, f: impl FnOnce(Option<&mut T>) -> R) -> R

Mutate the rightmost element of this slice via a closure, and return the result of the closure. Read more
Source§

fn foreach_mut(&mut self, f: impl FnMut(&mut T))

Run a closure on each of this slice’s elements, possibly mutating them, from left to right. Read more
Source§

fn take_all(&mut self) -> FoldChain<T, Self::OriginalD, Self::Settings>

Remove all elements from this slice, and return a new FoldChain containing them, in the same order as in this slice’s base FoldChain. Read more
Source§

fn drain(self) -> Drain<'a, T, D, Self>

Convert this slice into an Iterator that removes elements from the left as it emits them (or from the right with DoubleEndedIterator::next_back). Read more
Source§

fn append_all_right( &mut self, chain: FoldChain<T, Self::OriginalD, Self::Settings>, )

Append the entire contents of a FoldChain to the right of this slice. Read more
Source§

fn append_all_left( &mut self, chain: FoldChain<T, Self::OriginalD, Self::Settings>, )

Append the entire contents of a FoldChain to the left of this slice. Read more
Source§

fn append_left_from_iter(&mut self, iter: impl Iterator<Item = T>)

Append every element from an iterator to the left of this slice. Read more
Source§

fn append_right_from_iter(&mut self, iter: impl Iterator<Item = T>)

Append every element from an iterator to the right of this slice. Read more
Source§

impl<T: Send, D: Clone + Send, Settings: FoldSettings<T, D> + Send> Send for FoldChain<T, D, Settings>

Source§

impl<T: Sync, D: Clone + Sync, Settings: FoldSettings<T, D> + Sync> Sync for FoldChain<T, D, Settings>

Auto Trait Implementations§

§

impl<T, D, Settings> Freeze for FoldChain<T, D, Settings>
where Settings: Freeze,

§

impl<T, D, Settings> RefUnwindSafe for FoldChain<T, D, Settings>
where Settings: RefUnwindSafe, T: RefUnwindSafe, D: RefUnwindSafe,

§

impl<T, D, Settings> Unpin for FoldChain<T, D, Settings>
where Settings: Unpin,

§

impl<T, D, Settings> UnwindSafe for FoldChain<T, D, Settings>

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> CloneToUninit for T
where T: Clone,

Source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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.