1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-02-07 20:24:22 +01:00

51 lines
860 B
Rust
Raw Normal View History

2019-01-05 13:19:25 -08:00
//! Resource path matching library.
mod de;
mod path;
mod pattern;
mod router;
pub use self::de::PathDeserializer;
pub use self::path::Path;
pub use self::pattern::Pattern;
2019-01-05 22:00:38 -08:00
pub use self::router::{ResourceInfo, Router, RouterBuilder};
2019-01-05 13:19:25 -08:00
pub trait RequestPath {
fn path(&self) -> &str;
}
impl RequestPath for String {
fn path(&self) -> &str {
self.as_str()
}
}
impl<'a> RequestPath for &'a str {
fn path(&self) -> &str {
self
}
}
impl<T: AsRef<[u8]>> RequestPath for string::String<T> {
fn path(&self) -> &str {
&*self
}
}
2019-01-05 22:00:38 -08:00
2019-02-01 13:25:56 -08:00
#[cfg(feature = "http")]
mod url;
#[cfg(feature = "http")]
pub use self::url::Url;
2019-01-05 22:00:38 -08:00
#[cfg(feature = "http")]
mod http_support {
use super::RequestPath;
use http::Uri;
impl RequestPath for Uri {
fn path(&self) -> &str {
self.path()
}
}
}