pub struct Request<'a> {
pub middleware: HashMap<String, String>,
pub route: Option<Route>,
/* private fields */
}
Expand description
The struct that contains all the data sent by the browser.
Fields
middleware: HashMap<String, String>
route: Option<Route>
Implementations
sourceimpl<'a> Request<'a>
impl<'a> Request<'a>
sourcepub fn new(buffer: &[u8]) -> Option<Request<'_>>
pub fn new(buffer: &[u8]) -> Option<Request<'_>>
Creates and returns an instance of the ´Request´ struct with the data sent by the browser.
sourcepub fn get_method(&self) -> &String
pub fn get_method(&self) -> &String
Returns the http method of the request.
Examples
use kalgan::http::request::Request;
let method: &String = request.get_method();
sourcepub fn get_uri(&self) -> &String
pub fn get_uri(&self) -> &String
Returns the uri of the request.
Examples
use kalgan::http::request::Request;
let uri: &String = request.get_uri();
sourcepub fn get_protocol(&self) -> &String
pub fn get_protocol(&self) -> &String
Returns the http protocol of the request.
Examples
use kalgan::http::request::Request;
let protocol: &String = request.get_protocol();
Returns the collection of cookies of the request.
Examples
use std::collections::HashMap;
use kalgan::http::request::Request;
let cookies: &HashMap<String, String> = request.get_cookies();
sourcepub fn get_host(&self) -> &String
pub fn get_host(&self) -> &String
Returns the host field of the request.
Examples
use kalgan::http::request::Request;
let host: &String = request.get_host();
sourcepub fn get_user_agent(&self) -> &String
pub fn get_user_agent(&self) -> &String
Returns the user agent of the request.
Examples
use kalgan::http::request::Request;
let user_agent: &String = request.get_user_agent();
sourcepub fn get_input(&self) -> &HashMap<String, String>
pub fn get_input(&self) -> &HashMap<String, String>
Returns the input data collection of the request.
Examples
use std::collections::HashMap;
use kalgan::http::request::Request;
let input: &HashMap<String, String> = request.get_input();
sourcepub fn get_referer(&self) -> &String
pub fn get_referer(&self) -> &String
Returns the referer field of the request.
Examples
use std::collections::HashMap;
use kalgan::http::request::Request;
let referer: &String = request.get_referer();
Trait Implementations
sourceimpl<'de: 'a, 'a> Deserialize<'de> for Request<'a>
impl<'de: 'a, 'a> Deserialize<'de> for Request<'a>
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl<'a> RefUnwindSafe for Request<'a>
impl<'a> Send for Request<'a>
impl<'a> Sync for Request<'a>
impl<'a> Unpin for Request<'a>
impl<'a> UnwindSafe for Request<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more