pub struct Route {
pub name: String,
pub host: Option<String>,
pub path_prefix: String,
pub methods: Vec<String>,
pub headers: Vec<(String, String)>,
pub priority: i32,
pub document_root: PathBuf,
pub compression: Option<bool>,
}Expand description
One routing rule: request constraints and the document root it serves.
Fields§
§name: StringUnique name, used in errors and diagnostics.
host: Option<String>Host the request must name (the Host header without its port,
compared case-insensitively). None matches any host.
path_prefix: StringPath prefix, matched on segment boundaries: /docs matches
/docs and /docs/a.html, not /docsx. / matches every path.
methods: Vec<String>Allowed methods. Empty allows every method.
headers: Vec<(String, String)>Headers that must be present with exactly this value. Names are compared case-insensitively.
priority: i32Higher values are tried first. Defaults to 0.
document_root: PathBufDirectory served for requests that match this route.
compression: Option<bool>Some(false) serves this route uncompressed whatever the
server’s CompressionPolicy;
None or Some(true) follows the server.
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Route
impl<'de> Deserialize<'de> for Route
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Route
impl StructuralPartialEq for Route
Auto Trait Implementations§
impl Forget for Route
impl Freeze for Route
impl RefUnwindSafe for Route
impl Send for Route
impl Sync for Route
impl Unpin for Route
impl UnsafeUnpin for Route
impl UnwindSafe for Route
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.