Move uri module into http namespace.

This commit is contained in:
Sergio Benitez 2016-10-03 17:25:27 -07:00
parent 74ec26db95
commit 647efe15d1
7 changed files with 15 additions and 15 deletions

View File

@ -1,4 +1,5 @@
pub mod hyper;
pub mod uri;
mod cookies;
mod method;

View File

@ -1,8 +1,9 @@
use std::cell::Cell;
use super::Collider;
use std::convert::From;
use std::fmt::{self, Write};
use router::Collider;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct URI<'a> {
uri: &'a str,

View File

@ -1,10 +1,10 @@
use std::str::FromStr;
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddrV4, SocketAddrV6, SocketAddr};
use std::path::PathBuf;
use router::Segments;
use url;
use http::uri::Segments;
pub trait FromParam<'a>: Sized {
type Error;
fn from_param(param: &'a str) -> Result<Self, Self::Error>;

View File

@ -8,12 +8,9 @@ use term_painter::ToStyle;
use error::Error;
use super::{FromParam, FromSegments};
use hyper::header;
use router::URIBuf;
use router::URI;
use router::Route;
use http::hyper::{HyperCookie, HyperHeaders, HyperRequest, HyperRequestUri};
use http::uri::{URI, URIBuf};
use http::hyper::{header, HyperCookie, HyperHeaders, HyperRequest, HyperRequestUri};
use http::{Method, ContentType, Cookies};
/// The type for all incoming web requests.

View File

@ -48,11 +48,12 @@ impl<'a> Collider<str> for &'a str {
mod tests {
use std::str::FromStr;
use router::{Collider, URI};
use router::Collider;
use request::Request;
use response::Response;
use router::route::Route;
use http::{Method, ContentType};
use http::uri::URI;
use http::Method::*;

View File

@ -1,15 +1,13 @@
mod collider;
mod route;
mod uri;
pub use self::collider::Collider;
pub use self::uri::{URI, URIBuf, Segments};
pub use self::route::Route;
use std::collections::hash_map::HashMap;
use http::Method;
use request::Request;
use http::Method;
// type Selector = (Method, usize);
type Selector = Method;
@ -69,10 +67,11 @@ impl Router {
#[cfg(test)]
mod test {
use super::{Router, Route, URI};
use super::{Router, Route};
use http::Method;
use http::Method::*;
use http::uri::URI;
use {Response, Request};
fn dummy_handler(_req: &Request) -> Response<'static> {

View File

@ -1,15 +1,16 @@
use std::fmt;
use std::convert::From;
use super::Collider; // :D
use term_painter::ToStyle;
use term_painter::Color::*;
use super::{Collider, URI, URIBuf}; // :D
use codegen::StaticRouteInfo;
use handler::Handler;
use request::Request;
use http::{Method, ContentType};
use http::uri::{URI, URIBuf};
pub struct Route {
pub method: Method,