pub struct Split<'a, 'p, P: Pattern<'p>> { /* private fields */ }
Expand description
Const equivalent of core::str::Split<'a, P>
This is constructed with split
like this:
konst::string::split(string, delim)
Implementations§
Source§impl<'a, 'p, P: Pattern<'p>> Split<'a, 'p, P>
impl<'a, 'p, P: Pattern<'p>> Split<'a, 'p, P>
Sourcepub const fn next(self) -> Option<(&'a str, Self)>
pub const fn next(self) -> Option<(&'a str, Self)>
Advances the iterator and returns the next value.
Sourcepub const fn next_back(self) -> Option<(&'a str, Self)>
pub const fn next_back(self) -> Option<(&'a str, Self)>
Removes and returns an element from the end of the iterator.
Sourcepub const fn remainder(&self) -> &'a str
pub const fn remainder(&self) -> &'a str
Gets the remainder of the string.
§Example
let iter = konst::string::split("foo-bar-baz", "-");
assert_eq!(iter.remainder(), "foo-bar-baz");
let (elem, iter) = iter.next().unwrap();
assert_eq!(elem, "foo");
assert_eq!(iter.remainder(), "bar-baz");
let (elem, iter) = iter.next().unwrap();
assert_eq!(elem, "bar");
assert_eq!(iter.remainder(), "baz");
let (elem, iter) = iter.next().unwrap();
assert_eq!(elem, "baz");
assert_eq!(iter.remainder(), "");
Trait Implementations§
Auto Trait Implementations§
impl<'a, 'p, P> Freeze for Split<'a, 'p, P>
impl<'a, 'p, P> RefUnwindSafe for Split<'a, 'p, P>
impl<'a, 'p, P> Send for Split<'a, 'p, P>
impl<'a, 'p, P> Sync for Split<'a, 'p, P>
impl<'a, 'p, P> Unpin for Split<'a, 'p, P>
impl<'a, 'p, P> UnwindSafe for Split<'a, 'p, P>
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