Skip to main content

Input

Struct Input 

Source
pub struct Input<'a> {
    bytes: &'a [u8],
}

Fields§

§bytes: &'a [u8]

Trait Implementations§

Source§

impl<'a> AtEof for Input<'a>

Source§

fn at_eof(&self) -> bool

While it might be possible in some settings to determine that the connection has closed and no further data may arrive, it is quite irrelevant considering the particular syntax of GTP. The only use case would be determining malformed input which ends without proper termination but this is currently beyond the scope of this implementation.

Source§

impl<'a> Clone for Input<'a>

Source§

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

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a, S> Compare<S> for Input<'a>
where &'a [u8]: Compare<S>,

Source§

fn compare(&self, t: S) -> CompareResult

compares self to another value for equality
Source§

fn compare_no_case(&self, t: S) -> CompareResult

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

impl<'a> From<&'a [u8]> for Input<'a>

Source§

fn from(bytes: &'a [u8]) -> Self

Converts to this type from the input type.
Source§

impl<'a> InputIter for Input<'a>

Source§

type Item = u8

Source§

type RawItem = u8

Source§

type Iter = Enumerator<'a>

Source§

type IterElem = Iterator<'a>

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::RawItem) -> bool,

finds the byte position of the element
Source§

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

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

impl<'a> InputLength for Input<'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 Input<'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> Offset for Input<'a>

Source§

fn offset(&self, second: &Self) -> usize

offset between the first byte of self and the first byte of the argument
Source§

impl<'a> ParseTo for Input<'a>

Source§

impl<'a, R> ParseTo<R> for Input<'a>
where for<'b> &'b [u8]: ParseTo<R>,

Source§

fn parse_to(&self) -> Option<R>

Source§

impl<'a> ParseTo<Value> for Input<'a>

Source§

impl<'a> Slice for Input<'a>

Source§

impl<'a, R> Slice<R> for Input<'a>
where &'a [u8]: Slice<R>,

Source§

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

Source§

impl<'a> UnspecializedInput for Input<'a>

This allows us to use a default implementation for InputTakeAtPosition.

Auto Trait Implementations§

§

impl<'a> Freeze for Input<'a>

§

impl<'a> RefUnwindSafe for Input<'a>

§

impl<'a> Send for Input<'a>

§

impl<'a> Sync for Input<'a>

§

impl<'a> Unpin for Input<'a>

§

impl<'a> UnsafeUnpin for Input<'a>

§

impl<'a> UnwindSafe for Input<'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> InputTakeAtPosition for T

Source§

type Item = <T as InputIter>::RawItem

Source§

fn split_at_position<P>(&self, predicate: P) -> Result<(T, T), Err<T>>
where P: Fn(<T as InputTakeAtPosition>::Item) -> bool,

Source§

fn split_at_position1<P>( &self, predicate: P, e: ErrorKind, ) -> Result<(T, T), Err<T>>
where P: Fn(<T as InputTakeAtPosition>::Item) -> bool,

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.