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 Freeze for Request
impl !RefUnwindSafe for Request
impl Send for Request
impl Sync for Request
impl Unpin for Request
impl UnsafeUnpin for Request
impl !UnwindSafe 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more