Struct konst::string::CharIndices
source · 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