pub struct NickelRequest<'mw, 'server, D = ()> where
'server: 'mw,
'server: 'mw,
D: 'mw + 'mw, {
pub origin: Request<'mw, 'server>,
pub route_result: Option<RouteResult<'mw, D>>,
// some fields omitted
}
A container for all the request data.
The lifetime 'mw
represents the lifetime of various bits of
middleware state within nickel. It can vary and get shorter.
The lifetime 'server
represents the lifetime of data internal to
the server. It is fixed and longer than 'mw
.
the original hyper::server::Request
a HashMap<String, String>
holding all params with names and values
Get the Request's referer header
extern crate nickel;
use nickel::{Nickel, HttpRouter, Request, Response, MiddlewareResult};
use nickel::extensions::{Referer, Redirect};
fn referer<'mw, 'conn>(req: &mut Request<'mw, 'conn>, res: Response<'mw>) -> MiddlewareResult<'mw> {
let back = req.referer().unwrap_or("http://nickel-org.github.io/");
return res.redirect(back)
}
fn main() {
let mut server = Nickel::new();
server.get("/a", referer);
}
Extracts URL encoded data from the URL query string. # Examples ```{rust} #[macro_use] extern crate nickel; use nickel::{Nickel, HttpRouter, QueryString}; Read more
impl<'mw, 'server, D> Pluggable for Request<'mw, 'server, D> | [src] |
fn get<P>(&mut self) -> Result<<P as Key>::Value, <P as Plugin<Self>>::Error> where P: Plugin<Self>, Self: Extensible, <P as Key>::Value: Clone, <P as Key>::Value: Any, | |
Return a copy of the plugin's produced value. Read more
fn get_ref<P>( &mut self ) -> Result<&<P as Key>::Value, <P as Plugin<Self>>::Error> where P: Plugin<Self>, Self: Extensible, <P as Key>::Value: Any, | |
Return a reference to the plugin's produced value. Read more
fn get_mut<P>( &mut self ) -> Result<&mut <P as Key>::Value, <P as Plugin<Self>>::Error> where P: Plugin<Self>, Self: Extensible, <P as Key>::Value: Any, | |
Return a mutable reference to the plugin's produced value. Read more
fn compute<P>( &mut self ) -> Result<<P as Key>::Value, <P as Plugin<Self>>::Error> where P: Plugin<Self>, | |
Create and evaluate a once-off instance of a plugin.
Extracts URL encoded data from the request body. # Examples ```{rust} #[macro_use] extern crate nickel; use nickel::{Nickel, HttpRouter, FormBody}; Read more
impl<'mw, 'server, D> Extensible for Request<'mw, 'server, D> | [src] |
Get a reference to the type's extension storage.
Get a mutable reference to the type's extension storage.
Get a multipart reader for the request body, if the request is of the right type.
impl<'r, 'mw: 'r, 'server: 'mw, D: 'mw> From<&'r mut Request<'mw, 'server, D>> for Maybe<'r, 'mw, 'server, D> | [src] |
impl<'r, 'mw: 'r, 'server: 'mw, D: 'mw> Into<&'r mut Request<'mw, 'server, D>> for Maybe<'r, 'mw, 'server, D> | [src] |
impl<'r, 'mw: 'r, 'server: 'mw, D: 'mw> AsMut<&'r mut Request<'mw, 'server, D>> for Maybe<'r, 'mw, 'server, D> | [src] |
impl<'r, 'mw: 'r, 'server: 'mw, D: 'mw> AsRef<&'r mut Request<'mw, 'server, D>> for Maybe<'r, 'mw, 'server, D> | [src] |
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
impl<T> Typeable for T where T: Any, | |
Get the TypeId
of this object.
impl<T> UnsafeAny for T where T: Any, | |