mirror of
https://github.com/rwf2/Rocket.git
synced 2025-01-17 23:19:06 +00:00
Move uri module into http namespace.
This commit is contained in:
parent
74ec26db95
commit
647efe15d1
@ -1,4 +1,5 @@
|
|||||||
pub mod hyper;
|
pub mod hyper;
|
||||||
|
pub mod uri;
|
||||||
|
|
||||||
mod cookies;
|
mod cookies;
|
||||||
mod method;
|
mod method;
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use super::Collider;
|
|
||||||
use std::convert::From;
|
use std::convert::From;
|
||||||
use std::fmt::{self, Write};
|
use std::fmt::{self, Write};
|
||||||
|
|
||||||
|
use router::Collider;
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub struct URI<'a> {
|
pub struct URI<'a> {
|
||||||
uri: &'a str,
|
uri: &'a str,
|
@ -1,10 +1,10 @@
|
|||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddrV4, SocketAddrV6, SocketAddr};
|
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddrV4, SocketAddrV6, SocketAddr};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use router::Segments;
|
|
||||||
use url;
|
use url;
|
||||||
|
|
||||||
|
use http::uri::Segments;
|
||||||
|
|
||||||
pub trait FromParam<'a>: Sized {
|
pub trait FromParam<'a>: Sized {
|
||||||
type Error;
|
type Error;
|
||||||
fn from_param(param: &'a str) -> Result<Self, Self::Error>;
|
fn from_param(param: &'a str) -> Result<Self, Self::Error>;
|
||||||
|
@ -8,12 +8,9 @@ use term_painter::ToStyle;
|
|||||||
use error::Error;
|
use error::Error;
|
||||||
use super::{FromParam, FromSegments};
|
use super::{FromParam, FromSegments};
|
||||||
|
|
||||||
use hyper::header;
|
|
||||||
use router::URIBuf;
|
|
||||||
use router::URI;
|
|
||||||
use router::Route;
|
use router::Route;
|
||||||
|
use http::uri::{URI, URIBuf};
|
||||||
use http::hyper::{HyperCookie, HyperHeaders, HyperRequest, HyperRequestUri};
|
use http::hyper::{header, HyperCookie, HyperHeaders, HyperRequest, HyperRequestUri};
|
||||||
use http::{Method, ContentType, Cookies};
|
use http::{Method, ContentType, Cookies};
|
||||||
|
|
||||||
/// The type for all incoming web requests.
|
/// The type for all incoming web requests.
|
||||||
|
@ -48,11 +48,12 @@ impl<'a> Collider<str> for &'a str {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
use router::{Collider, URI};
|
use router::Collider;
|
||||||
use request::Request;
|
use request::Request;
|
||||||
use response::Response;
|
use response::Response;
|
||||||
use router::route::Route;
|
use router::route::Route;
|
||||||
use http::{Method, ContentType};
|
use http::{Method, ContentType};
|
||||||
|
use http::uri::URI;
|
||||||
|
|
||||||
use http::Method::*;
|
use http::Method::*;
|
||||||
|
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
mod collider;
|
mod collider;
|
||||||
mod route;
|
mod route;
|
||||||
mod uri;
|
|
||||||
|
|
||||||
pub use self::collider::Collider;
|
pub use self::collider::Collider;
|
||||||
pub use self::uri::{URI, URIBuf, Segments};
|
|
||||||
pub use self::route::Route;
|
pub use self::route::Route;
|
||||||
|
|
||||||
use std::collections::hash_map::HashMap;
|
use std::collections::hash_map::HashMap;
|
||||||
|
|
||||||
use http::Method;
|
|
||||||
use request::Request;
|
use request::Request;
|
||||||
|
use http::Method;
|
||||||
|
|
||||||
// type Selector = (Method, usize);
|
// type Selector = (Method, usize);
|
||||||
type Selector = Method;
|
type Selector = Method;
|
||||||
@ -69,10 +67,11 @@ impl Router {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::{Router, Route, URI};
|
use super::{Router, Route};
|
||||||
|
|
||||||
use http::Method;
|
use http::Method;
|
||||||
use http::Method::*;
|
use http::Method::*;
|
||||||
|
use http::uri::URI;
|
||||||
use {Response, Request};
|
use {Response, Request};
|
||||||
|
|
||||||
fn dummy_handler(_req: &Request) -> Response<'static> {
|
fn dummy_handler(_req: &Request) -> Response<'static> {
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::convert::From;
|
use std::convert::From;
|
||||||
|
|
||||||
|
use super::Collider; // :D
|
||||||
|
|
||||||
use term_painter::ToStyle;
|
use term_painter::ToStyle;
|
||||||
use term_painter::Color::*;
|
use term_painter::Color::*;
|
||||||
|
|
||||||
use super::{Collider, URI, URIBuf}; // :D
|
|
||||||
|
|
||||||
use codegen::StaticRouteInfo;
|
use codegen::StaticRouteInfo;
|
||||||
use handler::Handler;
|
use handler::Handler;
|
||||||
use request::Request;
|
use request::Request;
|
||||||
use http::{Method, ContentType};
|
use http::{Method, ContentType};
|
||||||
|
use http::uri::{URI, URIBuf};
|
||||||
|
|
||||||
pub struct Route {
|
pub struct Route {
|
||||||
pub method: Method,
|
pub method: Method,
|
||||||
|
Loading…
Reference in New Issue
Block a user