[][src]Struct sub_strs::SubStr

pub struct SubStr<'a> { /* fields omitted */ }

A sub string

This struct is used by SubStrIter, which can be made via sub_strs().

You can dereference this struct to &str. It can also give you start and end indexes of the original string.

Methods

impl<'_> SubStr<'_>[src]

pub fn start(&self) -> usize[src]

pub fn end(&self) -> usize[src]

pub fn inner(&self) -> &str[src]

Inner string between start and end phrases

Examples

use core::str::FromStr;

let sample = "some_id: 99,";
let some_id = sub_strs::sub_strs(sample, "some_id:", ",").next().unwrap();
assert_eq!(u8::from_str(some_id.inner().trim()).unwrap(), 99);

Trait Implementations

impl<'a> Debug for SubStr<'a>[src]

impl<'_> PartialEq<str> for SubStr<'_>[src]

impl<'a, '_> PartialEq<SubStr<'a>> for &'_ str[src]

impl<'_> PartialEq<String> for SubStr<'_>[src]

impl<'a> PartialEq<SubStr<'a>> for String[src]

impl<'_> Deref for SubStr<'_>[src]

type Target = str

The resulting type after dereferencing.

Auto Trait Implementations

impl<'a> Unpin for SubStr<'a>

impl<'a> Send for SubStr<'a>

impl<'a> Sync for SubStr<'a>

impl<'a> UnwindSafe for SubStr<'a>

impl<'a> RefUnwindSafe for SubStr<'a>

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]