pub(crate) enum CookieStr<'c> {
Indexed(usize, usize),
Concrete(Cow<'c, str>),
}Variants§
Indexed(usize, usize)
An string derived from indexes (start, end).
Concrete(Cow<'c, str>)
A string derived from a concrete string.
Implementations§
Source§impl<'c> CookieStr<'c>
impl<'c> CookieStr<'c>
Sourcepub(crate) fn indexed(
needle: &str,
haystack: &str,
) -> Option<CookieStr<'static>>
pub(crate) fn indexed( needle: &str, haystack: &str, ) -> Option<CookieStr<'static>>
Creates an indexed CookieStr that holds the start and end indices of
needle inside of haystack, if needle is a substring of haystack.
Otherwise returns None.
The needle can later be retrieved via to_str().
Sourcepub(crate) fn to_str<'s>(&'s self, string: Option<&'s Cow<'_, str>>) -> &'s str
pub(crate) fn to_str<'s>(&'s self, string: Option<&'s Cow<'_, str>>) -> &'s str
Retrieves the string self corresponds to. If self is derived from
indices, the corresponding subslice of string is returned. Otherwise,
the concrete string is returned.
§Panics
Panics if self is an indexed string and string is None.
pub(crate) fn to_raw_str<'s, 'b: 's>( &'s self, string: &'s Cow<'b, str>, ) -> Option<&'b str>
pub(crate) fn into_owned(self) -> CookieStr<'static>
Trait Implementations§
Auto Trait Implementations§
impl<'c> Freeze for CookieStr<'c>
impl<'c> RefUnwindSafe for CookieStr<'c>
impl<'c> Send for CookieStr<'c>
impl<'c> Sync for CookieStr<'c>
impl<'c> Unpin for CookieStr<'c>
impl<'c> UnwindSafe for CookieStr<'c>
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