pub struct Chars<'a> { /* private fields */ }
Expand description
Const equivalent of core::str::Chars
Implementations§
source§impl<'a> Chars<'a>
impl<'a> Chars<'a>
sourcepub const fn next(self) -> Option<(char, Self)>
pub const fn next(self) -> Option<(char, Self)>
Advances the iterator and returns the next value.
sourcepub const fn next_back(self) -> Option<(char, Self)>
pub const fn next_back(self) -> Option<(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::chars("hello world");
for_range!{_ in 0..6 =>
(_, iter) = option::unwrap!(iter.next());
}
iter.as_str()
};
assert_eq!(S, "world")
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Chars<'a>
impl<'a> RefUnwindSafe for Chars<'a>
impl<'a> Send for Chars<'a>
impl<'a> Sync for Chars<'a>
impl<'a> Unpin for Chars<'a>
impl<'a> UnwindSafe for Chars<'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