pub struct Request {
pub inputs: Value,
pub method: Method,
pub path: String,
pub headers: HashMap<String, String>,
pub session: Session,
pub state: AppState,
pub ip_address: String,
pub params: HashMap<String, String>,
}Fields§
§inputs: Value§method: Method§path: String§headers: HashMap<String, String>§session: Session§state: AppState§ip_address: String§params: HashMap<String, String>Route parameters, misal dari “/user/{id}” → params[“id”] = “123”
Implementations§
Source§impl Request
impl Request
pub fn input(&self, key: &str) -> Option<&Value>
pub fn input_as_str(&self, key: &str) -> Option<&str>
pub fn query(&self, key: &str) -> Option<&str>
pub fn all(&self) -> &Value
Sourcepub fn param(&self, key: &str) -> Option<&str>
pub fn param(&self, key: &str) -> Option<&str>
Ambil route parameter, misal req.param("id") dari route “/user/{id}”
pub fn validate<T: Validate + DeserializeOwned>( &self, ) -> Result<T, Box<(StatusCode, Response)>>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Request
impl !UnwindSafe for Request
impl Freeze for Request
impl Send for Request
impl Sync for Request
impl Unpin for Request
impl UnsafeUnpin for Request
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more