Struct ajars_actix_web::actix_web::http::Method [−][src]
pub struct Method(_);
Expand description
The Request Method (VERB)
This type also contains constants for a number of common HTTP methods such as GET, POST, etc.
Currently includes 8 variants representing the 8 methods defined in RFC 7230, plus PATCH, and an Extension variant for all extensions.
Examples
use http::Method;
assert_eq!(Method::GET, Method::from_bytes(b"GET").unwrap());
assert!(Method::GET.is_idempotent());
assert_eq!(Method::POST.as_str(), "POST");
Implementations
Converts a slice of bytes to an HTTP method.
Whether a method is considered “safe”, meaning the request is essentially read-only.
See the spec for more words.
Whether a method is considered “idempotent”, meaning the request has the same result if executed multiple times.
See the spec for more words.
Trait Implementations
Extract the request’s method.
Examples
use actix_web::{http::Method, web, App, Responder};
async fn handler(method: Method) -> impl Responder {
format!("Request method: {}", method)
}
let app = App::new().default_service(web::to(handler));
type Error = Infallible
type Error = Infallible
The associated error which can be returned.
pub fn from_request(
req: &HttpRequest,
&mut Payload<Pin<Box<dyn Stream<Item = Result<Bytes, PayloadError>> + 'static, Global>>>
) -> <Method as FromRequest>::Future
pub fn from_request(
req: &HttpRequest,
&mut Payload<Pin<Box<dyn Stream<Item = Result<Bytes, PayloadError>> + 'static, Global>>>
) -> <Method as FromRequest>::Future
Create a Self from request parts asynchronously.
Create a Self from request head asynchronously. Read more
Auto Trait Implementations
impl RefUnwindSafe for Method
impl UnwindSafe for Method
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
type Output = T
type Output = T
Should always be Self