[][src]Struct sharp_pencil::wrappers::Request

pub struct Request<'r, 'a, 'b: 'a> {
    pub app: &'r Pencil,
    pub remote_addr: SocketAddr,
    pub method: Method,
    pub headers: Headers,
    pub url: Url,
    pub url_rule: Option<Rule>,
    pub view_args: ViewArgs,
    pub routing_redirect: Option<(String, u16)>,
    pub routing_error: Option<HTTPError>,
    pub extensions_data: TypeMap,
    pub host: Host,
    // some fields omitted
}

Request type.

Fields

app: &'r Pencilremote_addr: SocketAddr

The IP address of the remote connection.

method: Method

The request method.

headers: Headers

The headers of the incoming request.

url: Url

The requested url.

url_rule: Option<Rule>

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

view_args: ViewArgs

A dict of view arguments that matched the request.

routing_redirect: Option<(String, u16)>

If matching the URL requests a redirect, this will be the redirect.

routing_error: Option<HTTPError>

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

extensions_data: TypeMap

Storage for data of extensions.

host: Host

The server host

Implementations

impl<'r, 'a, 'b: 'a> Request<'r, 'a, 'b>[src]

pub fn new(
    app: &'r Pencil,
    http_request: HttpRequest<'a, 'b>
) -> Result<Request<'r, 'a, 'b>, String>
[src]

Create a Request.

pub fn url_adapter(&self) -> MapAdapter<'_>[src]

Get the url adapter for this request.

pub fn match_request(&mut self)[src]

Match the request, set the url_rule and view_args field.

pub fn endpoint(&self) -> Option<String>[src]

The endpoint that matched the request.

pub fn module_name(&self) -> Option<String>[src]

The current module name.

pub fn args(&self) -> &MultiDict<String>[src]

The parsed URL parameters.

pub fn get_json(&self) -> &Option<Value>[src]

Parses the incoming JSON request data.

pub fn form(&self) -> &MultiDict<String>[src]

The form parameters.

pub fn files(&self) -> &MultiDict<FilePart>[src]

All uploaded files.

pub fn headers(&self) -> &Headers[src]

The headers.

pub fn path(&self) -> String[src]

Requested path.

pub fn full_path(&self) -> String[src]

Requested path including the query string.

pub fn host(&self) -> String[src]

The host including the port if available.

pub fn query_string(&self) -> Option<String>[src]

The query string.

pub fn cookies(&self) -> Option<&Cookie>[src]

The retrieved cookies.

pub fn method(&self) -> Method[src]

The request method.

pub fn remote_addr(&self) -> SocketAddr[src]

The remote address of the client.

pub fn scheme(&self) -> String[src]

URL scheme (http or https)

pub fn host_url(&self) -> String[src]

Just the host with scheme.

pub fn url(&self) -> String[src]

The current url.

pub fn base_url(&self) -> String[src]

The current url without the query string.

pub fn is_secure(&self) -> bool[src]

Whether the request is secure (https).

Trait Implementations

impl<'r, 'a, 'b: 'a> Debug for Request<'r, 'a, 'b>[src]

impl<'r, 'a, 'b: 'a> Read for Request<'r, 'a, 'b>[src]

Auto Trait Implementations

impl<'r, 'a, 'b> !RefUnwindSafe for Request<'r, 'a, 'b>

impl<'r, 'a, 'b> !Send for Request<'r, 'a, 'b>

impl<'r, 'a, 'b> !Sync for Request<'r, 'a, 'b>

impl<'r, 'a, 'b> Unpin for Request<'r, 'a, 'b> where
    'b: 'a, 

impl<'r, 'a, 'b> !UnwindSafe for Request<'r, 'a, 'b>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DebugAny for T where
    T: Any + Debug
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<R> ReadBytesExt for R where
    R: Read + ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Typeable for T where
    T: Any

impl<T> UnsafeAny for T where
    T: Any