RequestTarget

Enum RequestTarget 

Source
pub enum RequestTarget {
    Wildcard,
    Absolute {
        path: RequestTargetPath,
        query: QueryString,
    },
}
👎Deprecated: This crate has been renamed to http_tiny; you’re using an outdated version
Expand description

A request target (see https://tools.ietf.org/html/rfc7230#section-5.3)

§Note

We only support the absolute and the asterisk form.

§Warning

The path parser is pretty simple and basically follows two rules only:

  • the path must either be a wildcard (*) or must begin with a slash (/)
  • empty path components are ignored (i.e. /, // evaluate to [] and /test//path, /test//path/ etc. evaluate to ["test", "path"])

Other potentially dangerous components like .. are treated like normal components and do not cause an error.

§Warning

The query parser is also pretty simple and basically parses any key or key= or key=value component without further validation (with the excepttion that the URI escaping must be valid if present).

The following rules apply:

  • the query string must begin with a ?
  • keys don’t need a value (e.g. ?key0&key1)
  • keys can have an empty value (e.g. ?key0=&key1=)
  • keys can have a non-empty value (e.g. ?key0=value0&key1=value1
  • empty keys or key-value pairs are ignored (i.e. ?& evaluates to [] or ?key0&&key1 evaluates to ["key0": "", "key1": ""] or ?=value0&key1=value1& evaluates to ["key1": "value1"])

Variants§

§

Wildcard

👎Deprecated: This crate has been renamed to http_tiny; you’re using an outdated version

The requested path is a wildcard (“*” e.g. for OPTIONS requests)

§

Absolute

👎Deprecated: This crate has been renamed to http_tiny; you’re using an outdated version

The requested path

Fields

§path: RequestTargetPath
👎Deprecated: This crate has been renamed to http_tiny; you’re using an outdated version

The path components

§query: QueryString
👎Deprecated: This crate has been renamed to http_tiny; you’re using an outdated version

The query string

Implementations§

Source§

impl RequestTarget

Source

pub const fn new_wildcard() -> Self

👎Deprecated: This crate has been renamed to http_tiny; you’re using an outdated version

Creates a new wildcard request target

Source

pub const fn new_absolute(path: RequestTargetPath, query: QueryString) -> Self

👎Deprecated: This crate has been renamed to http_tiny; you’re using an outdated version

Creates a new request target from the given path and query components

Source

pub fn read<T>(source: &mut T) -> Result<Self>
where T: BufRead,

👎Deprecated: This crate has been renamed to http_tiny; you’re using an outdated version

Loads a request target

Source

pub fn write<T>(self, output: &mut T) -> Result
where T: Write,

👎Deprecated: This crate has been renamed to http_tiny; you’re using an outdated version

Writes the request target

Trait Implementations§

Source§

impl Clone for RequestTarget

Source§

fn clone(&self) -> RequestTarget

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 Debug for RequestTarget

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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