Enum http_tiny::RequestTarget
source · [−]pub enum RequestTarget {
Wildcard,
Absolute {
path: RequestTargetPath,
query: QueryString,
},
}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&&key1evaluates to["key0": "", "key1": ""]or?=value0&key1=value1&evaluates to["key1": "value1"])
Variants
Wildcard
The requested path is a wildcard (“*” e.g. for OPTIONS requests)
Absolute
The requested path
Implementations
sourceimpl RequestTarget
impl RequestTarget
sourcepub const fn new_wildcard() -> Self
pub const fn new_wildcard() -> Self
Creates a new wildcard request target
sourcepub const fn new_absolute(path: RequestTargetPath, query: QueryString) -> Self
pub const fn new_absolute(path: RequestTargetPath, query: QueryString) -> Self
Creates a new request target from the given path and query components
Trait Implementations
sourceimpl Clone for RequestTarget
impl Clone for RequestTarget
sourcefn clone(&self) -> RequestTarget
fn clone(&self) -> RequestTarget
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
Auto Trait Implementations
impl RefUnwindSafe for RequestTarget
impl Send for RequestTarget
impl Sync for RequestTarget
impl Unpin for RequestTarget
impl UnwindSafe for RequestTarget
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more