pub struct RSplit<'a, 'p, P: Pattern<'p>> { /* private fields */ }
Expand description
Const equivalent of core::str::RSplit<'a, P>
This is constructed with rsplit
like this:
konst::string::rsplit(string, delim)
Implementations§
source§impl<'a, 'p, P: Pattern<'p>> RSplit<'a, 'p, P>
impl<'a, 'p, P: Pattern<'p>> RSplit<'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::rsplit("foo-bar-baz", "-");
assert_eq!(iter.remainder(), "foo-bar-baz");
let (elem, iter) = iter.next().unwrap();
assert_eq!(elem, "baz");
assert_eq!(iter.remainder(), "foo-bar");
let (elem, iter) = iter.next().unwrap();
assert_eq!(elem, "bar");
assert_eq!(iter.remainder(), "foo");
let (elem, iter) = iter.next().unwrap();
assert_eq!(elem, "foo");
assert_eq!(iter.remainder(), "");
Trait Implementations§
Auto Trait Implementations§
impl<'a, 'p, P> Freeze for RSplit<'a, 'p, P>
impl<'a, 'p, P> RefUnwindSafe for RSplit<'a, 'p, P>
impl<'a, 'p, P> Send for RSplit<'a, 'p, P>
impl<'a, 'p, P> Sync for RSplit<'a, 'p, P>
impl<'a, 'p, P> Unpin for RSplit<'a, 'p, P>
impl<'a, 'p, P> UnwindSafe for RSplit<'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