Skip to main content

Parsed

Enum Parsed 

Source
#[non_exhaustive]
pub enum Parsed<T> { Complete { head: T, len: usize, }, Partial, }
Expand description

The result of a stateless parse: a complete head and how many input bytes it took, or Partial when the input ends before the head does.

§Examples

use http_net::{FieldSpan, Limits, Parsed, parse_request_head};

let mut fields = [FieldSpan::default(); 16];
let parsed = parse_request_head(b"GET / HTTP/1.1\r\nHo", &Limits::new(), &mut fields)?;
assert!(matches!(parsed, Parsed::Partial));

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Complete

A whole head: len bytes of the input, any leading empty lines included; the body (if any) starts there.

Fields

§head: T

The parsed head.

§len: usize

The bytes of input the head took.

§

Partial

The input ends before the head does: call again with more input.

Trait Implementations§

Source§

impl<T: Debug> Debug for Parsed<T>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> Freeze for Parsed<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Parsed<T>
where T: RefUnwindSafe,

§

impl<T> Send for Parsed<T>
where T: Send,

§

impl<T> Sync for Parsed<T>
where T: Sync,

§

impl<T> Unpin for Parsed<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for Parsed<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for Parsed<T>
where T: UnwindSafe,

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