[][src]Enum arithmetic_parser::CodeFragment

pub enum CodeFragment<'a> {
    Str(&'a str),
    Stripped(usize),
}

Container for a code fragment that can be in one of the two states: either the code string is retained, or it is stripped away.

The stripped version allows to retain information about code location within LocatedSpan without a restriction by the code lifetime.

Variants

Str(&'a str)

Original code fragment: a string reference.

Stripped(usize)

Stripped code fragment: just the string length.

Implementations

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

pub fn strip(self) -> CodeFragment<'static>[src]

Strips this code fragment, extending its lifetime beyond the lifetime of the code.

pub fn len(self) -> usize[src]

Gets the length of this code fragment.

pub fn is_empty(self) -> bool[src]

Checks if this code fragment is empty.

Trait Implementations

impl<'a> Clone for CodeFragment<'a>[src]

impl<'a> Copy for CodeFragment<'a>[src]

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

impl<'a> From<&'a str> for CodeFragment<'a>[src]

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

impl<'a> PartialEq<CodeFragment<'a>> for CodeFragment<'a>[src]

impl<'a> StructuralPartialEq for CodeFragment<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for CodeFragment<'a>

impl<'a> Send for CodeFragment<'a>

impl<'a> Sync for CodeFragment<'a>

impl<'a> Unpin for CodeFragment<'a>

impl<'a> UnwindSafe for CodeFragment<'a>

Blanket Implementations

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

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

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

impl<T> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

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

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

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T

impl<T> TryConv for T

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> 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.