Struct pencil::wrappers::Request [] [src]

pub struct Request<'r, 'a, 'b> {
    pub app: &'r Pencil,
    pub request: Request<'a, 'b>,
    pub url_rule: Option<Rule>,
    pub view_args: ViewArgs,
    pub routing_error: Option<HTTPError>,
    pub extensions_data: TypeMap,
    // some fields omitted
}

Request type.

Fields

app
request

The original hyper request object.

url_rule

The URL rule that matched the request. This is going to be None if nothing matched.

view_args

A dict of view arguments that matched the request.

routing_error

If matching the URL failed, this will be the error.

extensions_data

Storage for data of extensions.

Methods

impl<'r, 'a, 'b> Request<'r, 'a, 'b>

fn new(app: &'r Pencil, request: Request<'a, 'b>) -> Request<'r, 'a, 'b>

Create a Request.

fn match_request(&mut self)

Match the request, set the url_rule and view_args field.

fn endpoint(&self) -> Option<String>

The endpoint that matched the request.

fn module_name(&self) -> Option<String>

The current module name.

fn args(&mut self) -> &MultiDict<String>

The parsed URL parameters.

fn get_json(&mut self) -> &Option<Json>

Parses the incoming JSON request data.

fn form(&mut self) -> &MultiDict<String>

The form parameters.

fn files(&mut self) -> &MultiDict<UploadedFile>

All uploaded files.

fn headers(&self) -> &Headers

The headers.

fn path(&self) -> Option<String>

Requested path.

fn full_path(&self) -> Option<String>

Requested path including the query string.

fn host(&self) -> Option<String>

The host including the port if available.

fn query_string(&self) -> Option<String>

The query string.

fn cookies(&self) -> Option<&Cookie>

The retrieved cookies.

fn method(&self) -> Method

The request method.

fn remote_addr(&self) -> SocketAddr

The remote address of the client.

fn scheme(&self) -> String

URL scheme (http or https)

fn host_url(&self) -> Option<String>

Just the host with scheme.

fn url(&self) -> Option<String>

The current url.

fn base_url(&self) -> Option<String>

The current url without the query string.

fn is_secure(&self) -> bool

Whether the request is secure (https).

Trait Implementations

impl<'r, 'a, 'b> Debug for Request<'r, 'a, 'b>

fn fmt(&self, f: &mut Formatter) -> Result

impl<'r, 'a, 'b> Read for Request<'r, 'a, 'b>

fn read(&mut self, buf: &mut [u8]) -> Result<usize>

fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>

fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>

fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>

fn by_ref(&mut self) -> &mut Self

fn bytes(self) -> Bytes<Self>

fn chars(self) -> Chars<Self>

fn chain<R>(self, next: R) -> Chain<Self, R> where R: Read

fn take(self, limit: u64) -> Take<Self>

fn tee<W>(self, out: W) -> Tee<Self, W> where W: Write