Skip to content

Commit 925eeab

Browse files
committed
Add extensions map for middleware
1 parent e170301 commit 925eeab

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/conduit.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ extern crate semver;
22

33
use std::collections::HashMap;
44
use std::io::net::ip::IpAddr;
5+
use std::any::Any;
56

67
#[deriving(PartialEq, Show, Clone)]
78
pub enum Scheme {
@@ -34,6 +35,9 @@ pub enum Method<'a> {
3435
Other(&'a str)
3536
}
3637

38+
/// A Dictionary for extensions provided by the server or middleware
39+
pub type Extensions = HashMap<&'static str, Box<Any>>;
40+
3741
pub trait Request {
3842
/// The version of HTTP being used
3943
fn http_version(&self) -> semver::Version;
@@ -73,6 +77,12 @@ pub trait Request {
7377

7478
/// A Reader for the body of the request
7579
fn body<'a>(&'a mut self) -> &'a mut Reader;
80+
81+
/// A readable map of extensions
82+
fn extensions<'a>(&'a self) -> &'a Extensions;
83+
84+
/// A mutable map of extensions
85+
fn mut_extensions<'a>(&'a mut self) -> &'a mut Extensions;
7686
}
7787

7888
pub type HeaderEntries<'a> = Box<Iterator<(&'a str, Vec<&'a str>)>>;

0 commit comments

Comments
 (0)