Struct Elms

Source
pub struct Elms<'a> { /* private fields */ }
Expand description

Custom Input Type

Implementations§

Source§

impl<'a> Elms<'a>

Source

pub fn new(values: &'a [u8]) -> Self

Source

pub fn as_str(&self) -> Result<&str, Utf8Error>

Source

pub fn as_string(&self) -> Result<String, FromUtf8Error>

Trait Implementations§

Source§

impl<'a> AsBytes for Elms<'a>

Source§

fn as_bytes(&self) -> &[u8]

Casts the input type to a byte slice
Source§

impl<'a> Clone for Elms<'a>

Source§

fn clone(&self) -> Elms<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a, 'b> Compare<&'b str> for Elms<'a>

Source§

fn compare(&self, t: &'b str) -> CompareResult

Compares self to another value for equality
Source§

fn compare_no_case(&self, t: &'b str) -> CompareResult

Compares self to another value for equality independently of the case. Read more
Source§

impl<'a, 'b> Compare<Elms<'b>> for Elms<'a>

Source§

fn compare(&self, t: Elms<'b>) -> CompareResult

Compares self to another value for equality
Source§

fn compare_no_case(&self, t: Elms<'b>) -> CompareResult

Compares self to another value for equality independently of the case. Read more
Source§

impl ContextError<Elms<'_>> for UriParseError

Source§

fn add_context(_input: Elms<'_>, _ctx: &'static str, other: Self) -> Self

Creates a new error from an input position, a static string and an existing error. This is used mainly in the context combinator, to add user friendly information to errors when backtracking through a parse tree
Source§

impl<'a> Display for Elms<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<Elms<'_>> for Scheme

Source§

fn from(src: Elms<'_>) -> Self

Converts to this type from the input type.
Source§

impl<'a> InputIter for Elms<'a>

InputIter for Elms

This type provides essentially the same implementation as &’a u8.

Source§

type Item = u8

The current input type is a sequence of that Item type. Read more
Source§

type Iter = Enumerate<<Elms<'a> as InputIter>::IterElem>

An iterator over the input type, producing the item and its position for use with Slice. If we’re iterating over &str, the position corresponds to the byte index of the character
Source§

type IterElem = Copied<Iter<'a, u8>>

An iterator over the input type, producing the item
Source§

fn iter_indices(&self) -> Self::Iter

Returns an iterator over the elements and their byte offsets
Source§

fn iter_elements(&self) -> Self::IterElem

Returns an iterator over the elements
Source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

Finds the byte position of the element
Source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

Get the byte offset from the element’s position in the stream
Source§

impl<'a> InputLength for Elms<'a>

Source§

fn input_len(&self) -> usize

Calculates the input length, as indicated by its name, and the name of the trait itself
Source§

impl<'a> InputTake for Elms<'a>

Source§

fn take(&self, count: usize) -> Self

Returns a slice of count bytes. panics if count > length
Source§

fn take_split(&self, count: usize) -> (Self, Self)

Split the stream at the count byte offset. panics if count > length
Source§

impl<'a> InputTakeAtPosition for Elms<'a>

Source§

type Item = u8

The current input type is a sequence of that Item type. Read more
Source§

fn split_at_position<P, E: ParseError<Self>>( &self, predicate: P, ) -> IResult<Self, Self, E>
where P: Fn(Self::Item) -> bool,

Looks for the first element of the input type for which the condition returns true, and returns the input up to this position. Read more
Source§

fn split_at_position1<P, E: ParseError<Self>>( &self, predicate: P, e: ErrorKind, ) -> IResult<Self, Self, E>
where P: Fn(Self::Item) -> bool,

Looks for the first element of the input type for which the condition returns true and returns the input up to this position. Read more
Source§

fn split_at_position_complete<P, E: ParseError<Self>>( &self, predicate: P, ) -> IResult<Self, Self, E>
where P: Fn(Self::Item) -> bool,

Looks for the first element of the input type for which the condition returns true, and returns the input up to this position. Read more
Source§

fn split_at_position1_complete<P, E: ParseError<Self>>( &self, predicate: P, e: ErrorKind, ) -> IResult<Self, Self, E>
where P: Fn(Self::Item) -> bool,

Looks for the first element of the input type for which the condition returns true and returns the input up to this position. Read more
Source§

impl ParseError<Elms<'_>> for UriParseError

Source§

fn from_error_kind(input: Elms<'_>, kind: ErrorKind) -> Self

Creates an error from the input position and an ErrorKind
Source§

fn append(input: Elms<'_>, kind: ErrorKind, other: Self) -> Self

Combines an existing error with a new one created from the input position and an ErrorKind. This is useful when backtracking through a parse tree, accumulating error context on the way
Source§

fn from_char(input: Elms<'_>, c: char) -> Self

Creates an error from an input position and an expected character
Source§

fn or(self, other: Self) -> Self

Combines two existing errors. This function is used to compare errors generated in various branches of alt.
Source§

impl<'a> PartialEq for Elms<'a>

Source§

fn eq(&self, other: &Elms<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> Slice<Range<usize>> for Elms<'a>

Source§

fn slice(&self, range: Range<usize>) -> Self

Slices self according to the range argument
Source§

impl<'a> Slice<RangeFrom<usize>> for Elms<'a>

Source§

fn slice(&self, range: RangeFrom<usize>) -> Self

Slices self according to the range argument
Source§

impl<'a> Slice<RangeFull> for Elms<'a>

Source§

fn slice(&self, range: RangeFull) -> Self

Slices self according to the range argument
Source§

impl<'a> Slice<RangeTo<usize>> for Elms<'a>

Source§

fn slice(&self, range: RangeTo<usize>) -> Self

Slices self according to the range argument
Source§

impl<'a> StructuralPartialEq for Elms<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for Elms<'a>

§

impl<'a> RefUnwindSafe for Elms<'a>

§

impl<'a> Send for Elms<'a>

§

impl<'a> Sync for Elms<'a>

§

impl<'a> Unpin for Elms<'a>

§

impl<'a> UnwindSafe for Elms<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.