pub struct CharIndices<'a> { /* private fields */ }
Expand description
Const equivalent of core::str::CharIndices
Implementations§
Source§impl<'a> CharIndices<'a>
impl<'a> CharIndices<'a>
Sourcepub const fn rev(self) -> RCharIndices<'a>
pub const fn rev(self) -> RCharIndices<'a>
Reverses the iterator
Sourcepub const fn next(self) -> Option<((usize, char), Self)>
pub const fn next(self) -> Option<((usize, char), Self)>
Advances the iterator and returns the next value.
Sourcepub const fn next_back(self) -> Option<((usize, char), Self)>
pub const fn next_back(self) -> Option<((usize, char), Self)>
Removes and returns an element from the end of the iterator.
Sourcepub const fn as_str(&self) -> &'a str
pub const fn as_str(&self) -> &'a str
Gets a string slice to the yet-to-be-iterated characters.
§Example
use konst::{for_range, option, string};
const S: &str = {
let mut iter = string::char_indices("this is fine");
for_range!{_ in 0..8 =>
(_, iter) = option::unwrap!(iter.next());
}
iter.as_str()
};
assert_eq!(S, "fine")
Trait Implementations§
Source§impl ConstIntoIter for CharIndices<'_>
impl ConstIntoIter for CharIndices<'_>
Auto Trait Implementations§
impl<'a> Freeze for CharIndices<'a>
impl<'a> RefUnwindSafe for CharIndices<'a>
impl<'a> Send for CharIndices<'a>
impl<'a> Sync for CharIndices<'a>
impl<'a> Unpin for CharIndices<'a>
impl<'a> UnwindSafe for CharIndices<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more