Rev

Struct Rev 

Source
pub struct Rev<I>
where I: DoubleEndedBulk,
{ /* private fields */ }
Expand description

A double-ended bulk with the direction inverted.

This struct is created by the rev method on Bulk. See its documentation for more.

Implementations§

Source§

impl<I, const N: usize> Rev<ArrayChunks<I, N>>
where I: DoubleEndedBulk,

Source

pub const fn for_each_with_remainder<F>( self, f: F, ) -> <ArrayBuffer<I::Item, N, true> as IntoBulk>::IntoBulk
where ArrayChunks<I, N>: Sized, I: DoubleEndedBulk<Item> + Bulk, F: FnMut(<Self as IntoIterator>::Item), ArrayBuffer<I::Item, N, true>: IntoBulk,

Source

pub const fn try_for_each_with_remainder<F, R>( self, f: F, ) -> <<R as Try>::Residual as Residual<<ArrayBuffer<I::Item, N, true> as IntoBulk>::IntoBulk>>::TryType
where ArrayChunks<I, N>: Sized, I: DoubleEndedBulk<Item> + Bulk, F: FnMut(<ArrayChunks<I, N> as IntoIterator>::Item) -> R, ArrayBuffer<I::Item, N, true>: IntoBulk, R: Try<Output = (), Residual: Residual<<ArrayBuffer<I::Item, N, true> as IntoBulk>::IntoBulk, TryType: Try>>,

Source

pub const fn collect_with_remainder<C, A>( self, ) -> (C, <ArrayBuffer<I::Item, N, true> as IntoBulk>::IntoBulk)
where Self: Sized, I: Bulk<Item> + DoubleEndedBulk, C: FromBulk<A>, A: CollectionAdapter<Elem = [I::Item; N]> + for<'a> CollectionStrategy<ArrayChunksWithRemainder<'a, Rev<I>, N, true>, C> + ?Sized, ArrayBuffer<I::Item, N, true>: IntoBulk,

Source§

impl<I> Rev<I>
where I: DoubleEndedBulk,

Source

pub const fn into_inner(self) -> I

Consumes the Rev, returning the inner bulk.

§Examples
use bulks::*;

let s = b"foobar";
let mut s2: [_; _] = s.bulk()
    .copied()
    .rev()
    .into_inner()
    .collect();
assert_eq!(&s2, b"foobar");

Trait Implementations§

Source§

impl<I> Bulk for Rev<I>
where I: Bulk + DoubleEndedBulk,

Source§

type MinLength = <I as Bulk>::MinLength

Source§

type MaxLength = <I as Bulk>::MaxLength

Source§

fn len(&self) -> usize

Returns the exact length of the bulk. Read more
Source§

fn is_empty(&self) -> bool

Returns true if the iterator is empty. Read more
Source§

fn for_each<F>(self, f: F)
where Self: Sized, F: FnMut(Self::Item),

Calls a closure on each element of a bulk. Read more
Source§

fn try_for_each<F, R>(self, f: F) -> R
where Self: Sized, Self::Item:, F: FnMut(Self::Item) -> R, R: Try<Output = (), Residual>,

A bulk method that applies a fallible function to each item in the bulk, stopping at the first error and returning that error. Read more
Source§

type Nearest = Self::Nearest

Source§

type TryNearest = Self::TryNearest where Self::Item: Try

Source§

type Length = Self::Length

Source§

type Strategy<U, C> = Self::Strategy<U, C>

Source§

fn first(self) -> Option<Self::Item>
where Self::Item:, Self: Sized,

Returns the first value, and discards the rest of the bulk. Read more
Source§

fn last(self) -> Option<Self::Item>
where Self::Item:, Self: Sized,

Returns the last value, and discards the rest of the bulk. Read more
Source§

fn nth<L>(self, n: L) -> Option<Self::Item>
where Self: Sized, Self::Item:, L: LengthValue,

Returns the n-th value, and discards the rest of the bulk. Read more
Source§

fn fold<B, F>(self, init: B, f: F) -> B
where Self: Sized, B:, F: FnMut(B, Self::Item) -> B,

Folds every element into an accumulator by applying an operation, returning the final result. Read more
Source§

fn try_fold<B, F, R>(self, init: B, f: F) -> R
where B:, Self: Sized, Self::Item:, F: FnMut(B, Self::Item) -> R, R: Try<Output = B, Residual>,

TODO
Source§

fn reduce<F>(self, f: F) -> Option<Self::Item>
where Self: Sized, Self::Item:, F: FnMut(Self::Item, Self::Item) -> Self::Item,

TODO
Source§

fn try_reduce<F, R>( self, f: F, ) -> <R::Residual as Residual<Option<R::Output>>>::TryType
where Self: Sized, Self::Item:, F: FnMut(Self::Item, Self::Item) -> R, R: Try<Output = Self::Item, Residual: Residual<Option<Self::Item>, TryType: Try>>,

TODO
Source§

fn step_by<L>(self, step: L) -> StepBy<Self, L::Length<()>>
where Self: Sized, L: LengthValue,

Creates a bulk starting at the same point, but stepping by the given amount at each iteration. Read more
Source§

fn chain<U>(self, other: U) -> Chain<Self, U::IntoBulk>
where Self: Sized, U: IntoBulk<Item = Self::Item>,

Takes two bulks and creates a new bulk over both in sequence. Read more
Source§

fn zip<U>( self, other: U, ) -> Zip<Self, <<U as IntoContained>::IntoContained as IntoBulk>::IntoBulk>
where Self: Sized, U: IntoContainedBy<Self>,

‘Zips up’ two bulks or iterators into a single bulk of pairs. One of them must be a bulk. Read more
Source§

fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
where Self: Sized, Self::Item: Clone,

Creates a new bulk which places a copy of separator between adjacent items of the original bulk. Read more
Source§

fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
where Self: Sized, G: FnMut() -> Self::Item,

Creates a new bulk which places an item generated by separator between adjacent items of the original bulk. Read more
Source§

fn map<B, F>(self, f: F) -> Map<Self, F>
where Self: Sized, F: FnMut(Self::Item) -> B,

Takes a closure and creates a bulk which calls that closure on each element. Read more
Source§

fn enumerate(self) -> Enumerate<Self>
where Self: Sized,

Creates a bulk which gives the current index together with its values. Read more
Source§

fn enumerate_from<U>(self, initial_count: U) -> EnumerateFrom<Self, U>
where Self: Sized, U: Step + Copy,

Creates a bulk which gives the current index counting from a given initial index together with its values. Read more
Source§

fn skip<L>(self, n: L) -> Skip<Self, L::Length<()>>
where Self: Sized, L: LengthValue,

Creates a bulk that skips the first n elements. Read more
Source§

fn take<L>(self, n: L) -> Take<Self, L::Length<()>>
where Self: Sized, L: LengthValue,

Creates a bulk for the first n elements, or fewer if the underlying bulk/iterator is shorter. Read more
Source§

fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
where Self: Sized, U: IntoBulk<IntoBulk: StaticBulk>, F: FnMut(Self::Item) -> U,

Creates a bulk that works like map, but flattens nested structure. Read more
Source§

fn flatten(self) -> Flatten<Self>
where Self: Sized, Self::Item: IntoBulk<IntoBulk: StaticBulk>,

Creates a bulk that flattens nested structure. Read more
Source§

fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
where Self: Sized, F: FnMut(&[Self::Item; N]) -> R,

Calls the given function f for each contiguous window of size N over self and returns a bulk of the outputs of f. The windows during mapping will overlap. Read more
Source§

fn inspect<F>(self, f: F) -> Inspect<Self, F>
where Self: Sized, F: FnMut(&Self::Item),

Does something with each element of a bulk, passing the value on. Read more
Source§

fn mutate<F>(self, f: F) -> Mutate<Self, F>
where Self: Sized, F: FnMut(&mut Self::Item),

Mutates with each element of a bulk, passing the value on. Read more
Source§

fn collect<C, A>(self) -> C
where Self: Sized, C: FromBulk<A>, A: CollectionAdapter<Elem = Self::Item> + CollectionStrategy<Self, C> + ?Sized,

Transforms a bulk into a collection. Read more
Source§

fn try_collect<C, A>( self, ) -> <<Self::Item as Try>::Residual as Residual<C>>::TryType
where Self: Sized, C: FromBulk<A>, A: CollectionAdapter<Elem = <Self::Item as Try>::Output> + TryCollectionAdapter<Self, C> + ?Sized, Self::Item: Try<Residual: Residual<C, TryType: Try>>,

Fallibly transforms a bulk into a collection, short circuiting if a failure is encountered. Read more
Source§

fn collect_array( self, ) -> <Self as StaticBulk>::Array<<Self as IntoIterator>::Item>
where Self: StaticBulk,

Transforms a statically sized bulk into an array. The bulk must implement StaticBulk. Read more
Source§

fn try_collect_array( self, ) -> <<Self::Item as Try>::Residual as Residual<Self::Array<<Self::Item as Try>::Output>>>::TryType
where Self: StaticBulk<Item: Try<Residual: Residual<(), TryType: Try> + Residual<Self::Array<<Self::Item as Try>::Output>, TryType: Try>, Output>> + Bulk,

Fallibly transforms a statically sized bulk into an array, short circuiting if a failure is encountered. The bulk must implement StaticBulk. Read more
Source§

fn collect_nearest(self) -> Self::Nearest
where Self: Sized, Self::Nearest: FromBulk<Self::Strategy<Self::Item, Self::Nearest>>, Self::Strategy<Self::Item, Self::Nearest>: CollectionAdapter<Elem = Self::Item> + CollectionStrategy<Self, Self::Nearest>,

Collects into an array if possible, otherwise a vector (if feature “alloc” is enabled)
Source§

fn try_collect_nearest( self, ) -> <<Self::Item as Try>::Residual as Residual<Self::TryNearest>>::TryType
where Self: Sized, Self::TryNearest: FromBulk<Self::Strategy<<Self::Item as Try>::Output, Self::TryNearest>>, Self::Strategy<<Self::Item as Try>::Output, Self::TryNearest>: CollectionAdapter<Elem = <Self::Item as Try>::Output> + TryCollectionAdapter<Self, Self::TryNearest>, Self::Item: Try<Residual: Residual<Self::TryNearest, TryType: Try>>,

Fallibly collects into an array if possible, otherwise a vector (if feature “alloc” is enabled)
Source§

fn rev(self) -> Rev<Self>
where Self: Sized + DoubleEndedBulk,

Reverses a bulks’s direction. Read more
Source§

fn copied<'a, T>(self) -> Copied<Self>
where T: Copy + 'a, Self: Sized + Bulk<Item = &'a T>,

Creates a bulk which copies all of its elements. Read more
Source§

fn cloned<'a, T>(self) -> Cloned<Self>
where T: Clone + 'a, Self: Sized + Bulk<Item = &'a T>,

Creates a bulk which clones all of its elements. Read more
Source§

fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
where Self: Sized,

Returns a bulk of N elements of the bulk at a time. Read more
Source§

impl<I> Clone for Rev<I>

Source§

fn clone(&self) -> Rev<I>

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<I> Debug for Rev<I>

Source§

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

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

impl<I> Default for Rev<I>

Source§

fn default() -> Self

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

impl<I> DoubleEndedBulk for Rev<I>
where I: Bulk + DoubleEndedBulk,

Source§

fn rev_for_each<F>(self, f: F)
where Self: Sized, F: FnMut(Self::Item),

Calls a closure on each element of a bulk in reverse.
Source§

fn try_rev_for_each<F, R>(self, f: F) -> R
where Self: Sized, Self::Item:, F: FnMut(Self::Item) -> R, R: Try<Output = (), Residual>,

A bulk method that applies a fallible function to each item in the bulk in reverse, stopping at the first error and returning that error.
Source§

impl<I> IntoIterator for Rev<I>
where I: DoubleEndedBulk,

Source§

type IntoIter = Rev<<I as IntoIterator>::IntoIter>

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

type Item = <I as IntoIterator>::Item

The type of the elements being iterated over.
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<I, N, L, R> SplitBulk<L> for Rev<I>
where I: SplitBulk<R, Left: Bulk + DoubleEndedBulk, Right: Bulk + DoubleEndedBulk> + Bulk<Length: Length<Value = N> + Pointee<Metadata = N::Metadata>> + DoubleEndedBulk, N: LengthValue<SaturatingSub<L> = R>, L: LengthValue, R: LengthValue,

Source§

type Left = Rev<<I as SplitBulk<R>>::Right>

Source§

type Right = Rev<<I as SplitBulk<R>>::Left>

Source§

fn split_at(self, m: L) -> (Self::Left, Self::Right)
where Self: Sized,

Splits a bulk in two at a specified index. Read more

Auto Trait Implementations§

§

impl<I> Freeze for Rev<I>
where I: Freeze,

§

impl<I> RefUnwindSafe for Rev<I>
where I: RefUnwindSafe,

§

impl<I> Send for Rev<I>
where I: Send,

§

impl<I> Sync for Rev<I>
where I: Sync,

§

impl<I> Unpin for Rev<I>
where I: Unpin,

§

impl<I> UnwindSafe for Rev<I>
where I: 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> AsBulk for T
where T: ?Sized,

Source§

fn bulk<'a>(&'a self) -> <&'a Self as IntoBulk>::IntoBulk
where &'a Self: IntoBulk,

Creates a bulk from a reference. Read more
Source§

fn bulk_mut<'a>(&'a mut self) -> <&'a mut Self as IntoBulk>::IntoBulk
where &'a mut Self: IntoBulk,

Creates a bulk from a mutable reference. 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<C, F> Curry<C> for F

Source§

type Output = Curried<(C,), (), F>

Source§

fn curry_once(self, arg: C) -> <F as Curry<C>>::Output

Source§

fn curry_mut(&mut self, arg: C) -> <&mut Self as Curry<C>>::Output

Source§

fn curry(&self, arg: C) -> <&Self as Curry<C>>::Output

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, A, I> IntoBulk for T
where T: IntoIterator<Item = A, IntoIter = I>, I: ExactSizeIterator<Item = A>,

Source§

type IntoBulk = Bulk<T>

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

default fn into_bulk(self) -> <T as IntoBulk>::IntoBulk

Creates a bulk from a value. Read more
Source§

impl<T> IntoBulk for T
where T: Bulk,

Source§

type IntoBulk = T

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

fn into_bulk(self) -> <T as IntoBulk>::IntoBulk

Creates a bulk from a value. Read more
Source§

impl<A, T> MaybeBulk for T
where T: Bulk<Item = A>, <T as Bulk>::MaxLength: MaybeLength, <T as Bulk>::MinLength: MaybeLength,

Source§

impl<A, T, const N: usize> MaybeBulk for T
where T: StaticBulk<Item = A, Array<()> = [(); N], Array<A> = [A; N]> + Bulk, [A; N]: Maybe<Item = A>, [(); N]: MaybeLength,

Source§

impl<C, F> RCurry<C> for F

Source§

type Output = Curried<(), (C,), F>

Source§

fn rcurry_once(self, arg: C) -> <F as RCurry<C>>::Output

Source§

fn rcurry_mut(&mut self, arg: C) -> <&mut Self as RCurry<C>>::Output

Source§

fn rcurry(&self, arg: C) -> <&Self as RCurry<C>>::Output

Source§

impl<U> Same for U

Source§

fn same<T>(self) -> Result<T, U>

Source§

impl<T, const N: usize> StaticBulk for T
where T: Bulk<MinLength = [(); N], MaxLength = [(); N]>,

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, B> EitherIntoBulk<B> for T
where T: EitherIntoBulk<B>, <T as EitherIntoBulk<B>>::EitherIntoBulk: IntoBulk, B: IntoIterator,

Source§

impl<T> EmptyBulk for T
where T: DoubleEndedBulk + StaticBulk<Array<<T as IntoIterator>::Item> = [<T as IntoIterator>::Item; 0]>,

Source§

impl<T, B> IntoContainedBy<B> for T
where T: IntoContained + EitherIntoBulk<B>, B: IntoIterator,

Source§

impl<T> OnceBulk for T
where T: DoubleEndedBulk + StaticBulk<Array<<T as IntoIterator>::Item> = [<T as IntoIterator>::Item; 1]>,