Skip to main content

Between

Trait Between 

Source
pub trait Between<'a> {
    // Required methods
    fn between(&self, delim: (&'_ str, &'_ str)) -> Option<&'a str>;
    fn between_infallible(&self, delim: (&'_ str, &'_ str)) -> &'a str;
}
Expand description

Slice a string between a pair of delimiters.

Required Methods§

Source

fn between(&self, delim: (&'_ str, &'_ str)) -> Option<&'a str>

Extract a string between the delimiters. If the delimiters were not found None is returned, otherwise the first extraction is returned.

Source

fn between_infallible(&self, delim: (&'_ str, &'_ str)) -> &'a str

Extract a string between the delimiters. If the delimiters were not found the original string is returned; take note of this behavior, if an empty slice is desired for this case use the fallible version and unwrap to EMPTY.

Implementations on Foreign Types§

Source§

impl<'a> Between<'a> for &'a str

Source§

fn between_infallible(&self, delim: (&'_ str, &'_ str)) -> &'a str

Source§

fn between(&self, delim: (&'_ str, &'_ str)) -> Option<&'a str>

Implementors§