Chars

Struct Chars 

Source
pub struct Chars<'s> { /* private fields */ }
Expand description

Represents non-empty iterators over the characters in non-empty strings.

This struct is created by the chars method on NonEmptyStr.

Implementations§

Source§

impl<'s> Chars<'s>

Source

pub const fn new(string: &'s NonEmptyStr) -> Self

Constructs Self.

Trait Implementations§

Source§

impl<'s> Debug for Chars<'s>

Source§

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

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

impl<'s> IntoIterator for Chars<'s>

Source§

type Item = char

The type of the elements being iterated over.
Source§

type IntoIter = Chars<'s>

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 NonEmptyIterator for Chars<'_>

Source§

fn consume(self) -> (Self::Item, Self::IntoIter)

Consumes the non-empty iterator, returning the next item along with the possibly empty iterator.
Source§

fn count(self) -> NonZero<usize>

Consumes the non-empty iterator, returning the item count. Read more
Source§

fn enumerate(self) -> Enumerate<Self>

Creates non-empty iterators that yield the current count and the item during iteration. Read more
Source§

fn peeked(self) -> Peeked<Self::IntoIter>

Peeks at the next item of the non-empty iterator, returning it along with the possibly empty iterator. Read more
Source§

fn chain<I>(self, other: I) -> Chain<Self, <I as IntoIterator>::IntoIter>
where I: IntoIterator<Item = Self::Item>,

Links the non-empty iterator with the provided possibly empty iterator. Read more
Source§

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

Creates non-empty iterators that clone the items of the underlying non-empty iterator. Read more
Source§

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

Creates non-empty iterators that copy the items of the underlying non-empty iterator. Read more
Source§

fn zip<I>( self, other: I, ) -> Zip<Self, <I as IntoNonEmptyIterator>::IntoNonEmptyIter>

Zips the non-empty iterator with the provided non-empty iterator. Read more
Source§

fn sum<S>(self) -> S
where S: Sum<Self::Item>,

Sums the items of the non-empty iterator together. Read more
Source§

fn product<P>(self) -> P
where P: Product<Self::Item>,

Multiplies the items of the non-empty iterator together. Read more
Source§

fn all<P>(self, predicate: P) -> bool
where P: FnMut(Self::Item) -> bool,

Tests whether all items of the non-empty iterator match the predicate. Read more
Source§

fn any<P>(self, predicate: P) -> bool
where P: FnMut(Self::Item) -> bool,

Tests whether any items of the non-empty iterator match the predicate. Read more
Source§

fn none<P>(self, predicate: P) -> bool
where P: FnMut(Self::Item) -> bool,

Tests whether no items of the non-empty iterator match the predicate. Read more
Source§

fn reduce<F>(self, function: F) -> Self::Item
where F: FnMut(Self::Item, Self::Item) -> Self::Item,

Reduces the items of the non-empty iterator into the single one by repeatedly applying the given function. Read more
Source§

fn unzip<T, U, C, D>(self) -> (C, D)
where C: Default + Extend<T>, D: Default + Extend<U>, Self: NonEmptyIterator<Item = (T, U)>,

Converts the non-empty iterator of pairs into the pair of collections. Read more
Source§

fn collect<C>(self) -> C
where C: FromIterator<Self::Item>,

Equivalent to collect on Iterator. Read more
Source§

fn collect_non_empty<C>(self) -> C
where C: FromNonEmptyIterator<Self::Item>,

Collects the items of the non-empty iterator into the collection. Read more
Source§

fn flat_map<J, F>(self, function: F) -> FlatMap<Self, J, F>
where J: IntoNonEmptyIterator, F: FnMut(Self::Item) -> J,

Similar to map, but flattens produced non-empty iterators. Read more
Source§

fn flatten(self) -> Flatten<Self>

Flattens one level of nesting in self non-empty iterator. Read more
Source§

fn filter<P>(self, predicate: P) -> Filter<Self::IntoIter, P>
where P: FnMut(&Self::Item) -> bool,

Equivalent to filter on Iterator. Read more
Source§

fn find<P>(self, predicate: P) -> Option<Self::Item>
where P: FnMut(&Self::Item) -> bool,

Equivalent to find on Iterator.
Source§

fn filter_map<T, F>(self, function: F) -> FilterMap<Self::IntoIter, F>
where F: FnMut(Self::Item) -> Option<T>,

Equivalent to filter_map on Iterator. Read more
Source§

fn fold<A, F>(self, initial: A, function: F) -> A
where F: FnMut(A, Self::Item) -> A,

Equivalent to fold on Iterator.
Source§

fn map<U, F>(self, function: F) -> Map<Self, F>
where F: FnMut(Self::Item) -> U,

Creates non-empty iterators that map the items of the non-empty iterator with the function. Read more
Source§

fn max(self) -> Self::Item
where Self::Item: Ord,

Returns the maximum item of the non-empty iterator. Read more
Source§

fn max_by<F>(self, function: F) -> Self::Item
where F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the maximum item of the non-empty iterator with respect to the comparison function. Read more
Source§

fn max_by_key<K, F>(self, function: F) -> Self::Item
where K: Ord, F: FnMut(&Self::Item) -> K,

Returns the maximum item of the non-empty iterator with respect to the key function. Read more
Source§

fn min(self) -> Self::Item
where Self::Item: Ord,

Returns the minimum item of the non-empty iterator. Read more
Source§

fn min_by<F>(self, function: F) -> Self::Item
where F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the minimum item of the non-empty iterator with respect to the comparison function. Read more
Source§

fn min_by_key<K, F>(self, function: F) -> Self::Item
where K: Ord, F: FnMut(&Self::Item) -> K,

Returns the minimum item of the non-empty iterator with respect to the key function. Read more
Source§

fn nth(self, n: NonZero<usize>) -> Option<Self::Item>

Returns the n-th item of the non-empty iterator. Read more
Source§

fn skip(self, count: NonZero<usize>) -> Skip<Self::IntoIter>

Skips the first given number of items in the non-empty iterator. Read more
Source§

fn take(self, count: NonZero<usize>) -> Take<Self>

Takes only the first given number of items from the non-empty iterator. Read more
Source§

fn last(self) -> Self::Item

Returns the last item of the non-empty iterator. Read more
Source§

fn step_by(self, step: NonZero<usize>) -> StepBy<Self>

Steps the non-empty iterator by the given custom amount. Read more
Source§

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

Equivalent to for_each on Iterator.
Source§

fn exhaust(self)

Consumes the iterator, exhausting it by dropping all of its items. Read more
Source§

fn skip_while<P>(self, predicate: P) -> SkipWhile<Self::IntoIter, P>
where P: FnMut(&Self::Item) -> bool,

Equivalent to skip_while on Iterator. Read more
Source§

fn take_while<P>(self, predicate: P) -> TakeWhile<Self::IntoIter, P>
where P: FnMut(&Self::Item) -> bool,

Equivalent to take_while on Iterator. Read more
Source§

fn map_while<T, P>(self, predicate: P) -> MapWhile<Self::IntoIter, P>
where P: FnMut(Self::Item) -> Option<T>,

Equivalent to map_while on Iterator. Read more
Source§

fn scan<S, T, F>(self, initial: S, function: F) -> Scan<Self::IntoIter, S, F>
where F: FnMut(&mut S, Self::Item) -> Option<T>,

Equivalent to scan on Iterator. Read more
Source§

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

Creates non-empty iterators that call the provided function with references to each item. Read more
Source§

fn partition<C, F>(self, function: F) -> (C, C)
where C: Default + Extend<Self::Item>, F: FnMut(&Self::Item) -> bool,

Equivalent to partition on Iterator.
Source§

fn position<P>(self, predicate: P) -> Option<usize>
where P: FnMut(Self::Item) -> bool,

Equivalent to position on Iterator.
Source§

fn cmp<I>(self, other: I) -> Ordering
where I: IntoIterator<Item = Self::Item>, Self::Item: Ord,

Equivalent to cmp on Iterator.
Source§

fn partial_cmp<I>(self, other: I) -> Option<Ordering>
where I: IntoIterator, Self::Item: PartialOrd<<I as IntoIterator>::Item>,

Equivalent to partial_cmp on Iterator.
Source§

fn eq<I>(self, other: I) -> bool
where I: IntoIterator, Self::Item: PartialEq<<I as IntoIterator>::Item>,

Equivalent to eq on Iterator.
Source§

fn ne<I>(self, other: I) -> bool
where I: IntoIterator, Self::Item: PartialEq<<I as IntoIterator>::Item>,

Equivalent to ne on Iterator.
Source§

fn lt<I>(self, other: I) -> bool
where I: IntoIterator, Self::Item: PartialOrd<<I as IntoIterator>::Item>,

Equivalent to lt on Iterator.
Source§

fn le<I>(self, other: I) -> bool
where I: IntoIterator, Self::Item: PartialOrd<<I as IntoIterator>::Item>,

Equivalent to le on Iterator.
Source§

fn gt<I>(self, other: I) -> bool
where I: IntoIterator, Self::Item: PartialOrd<<I as IntoIterator>::Item>,

Equivalent to gt on Iterator.
Source§

fn ge<I>(self, other: I) -> bool
where I: IntoIterator, Self::Item: PartialOrd<<I as IntoIterator>::Item>,

Equivalent to ge on Iterator.
Source§

fn is_sorted(self) -> bool
where Self::Item: PartialOrd,

Equivalent to is_sorted on Iterator.
Source§

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

Equivalent to is_sorted_by on Iterator.
Source§

fn is_sorted_by_key<K, F>(self, function: F) -> bool
where K: PartialOrd, F: FnMut(Self::Item) -> K,

Equivalent to is_sorted_by_key on Iterator.
Source§

fn collect_into<C>(self, collection: &mut C) -> &mut C
where C: Extend<Self::Item>,

Similar to collect, but extends the provided collection instead of creating new ones. Read more
Source§

fn find_map<T, F>(self, function: F) -> Option<T>
where F: FnMut(Self::Item) -> Option<T>,

Equivalent to find_map on Iterator.
Source§

fn fuse(self) -> Fuse<Self>

Fuses the non-empty iterator, ensuring that once it returns None, it will return None forever afterwards. Read more
Source§

fn rev(self) -> Rev<Self>

Reverses the iteration in non-empty iterators. Read more
Source§

fn cycle(self) -> Cycle<Self>
where Self::IntoIter: Clone,

Repeats the non-empty iterator endlessly. Read more

Auto Trait Implementations§

§

impl<'s> Freeze for Chars<'s>

§

impl<'s> RefUnwindSafe for Chars<'s>

§

impl<'s> Send for Chars<'s>

§

impl<'s> Sync for Chars<'s>

§

impl<'s> Unpin for Chars<'s>

§

impl<'s> UnwindSafe for Chars<'s>

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> 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<I> IntoNonEmptyIterator for I

Source§

type IntoNonEmptyIter = I

What kind of NonEmptyIterator are we turning this into?
Source§

fn into_non_empty_iter(self) -> <I as IntoNonEmptyIterator>::IntoNonEmptyIter

Converts self into NonEmptyIterator.
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<I> TryIntoNonEmptyIterator for I
where I: IntoIterator,

Source§

type Item = <I as IntoIterator>::Item

The type of the items being iterated over.
Source§

type IntoNonEmptyIter = NonEmptyAdapter<Peekable<<I as IntoIterator>::IntoIter>>

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

fn try_into_non_empty_iter( self, ) -> Option<<I as TryIntoNonEmptyIterator>::IntoNonEmptyIter>

Tries to convert self into NonEmptyIterator. Read more