pub enum Method {
GET,
POST,
PUT,
DELETE,
PATCH,
HEAD,
OPTIONS,
CONNECT,
TRACE,
UNKNOWN(String),
}Expand description
Defines the Method enum, representing HTTP request methods.
This enum provides a comprehensive list of standard HTTP methods,
such as GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS, CONNECT, and TRACE.
It also includes an UNKNOWN variant for unrecognized methods.
Variants§
GET
Represents the HTTP GET method.
POST
Represents the HTTP POST method.
PUT
Represents the HTTP PUT method.
DELETE
Represents the HTTP DELETE method.
PATCH
Represents the HTTP PATCH method.
HEAD
Represents the HTTP HEAD method.
OPTIONS
Represents the HTTP OPTIONS method.
CONNECT
Represents the HTTP CONNECT method.
TRACE
Represents the HTTP TRACE method.
UNKNOWN(String)
Unknown
Implementations§
Source§impl Method
impl Method
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new instance of Method with the default value of Self::GET.
This is a shorthand for using the default method.
§Returns
A new Method instance.
Sourcepub fn is_options(&self) -> bool
pub fn is_options(&self) -> bool
Sourcepub fn is_connect(&self) -> bool
pub fn is_connect(&self) -> bool
Sourcepub fn is_unknown(&self) -> bool
pub fn is_unknown(&self) -> bool
Trait Implementations§
Source§impl Display for Method
Implements the Display trait for Method, allowing it to be formatted as a string.
impl Display for Method
Implements the Display trait for Method, allowing it to be formatted as a string.
Source§impl FromStr for Method
Implements the FromStr trait for Method, allowing conversion from a string slice.
impl FromStr for Method
Implements the FromStr trait for Method, allowing conversion from a string slice.
Source§fn from_str(methods_str: &str) -> Result<Self, Self::Err>
fn from_str(methods_str: &str) -> Result<Self, Self::Err>
Converts a string slice into a Method variant.
This method attempts to parse the input string into a known Method variant.
If the string does not match any known method, it returns an UNKNOWN variant
containing the original string.
§Arguments
methods_str- The string slice to convert.
§Returns
A Result containing the Method variant if successful, or Self::Err on failure.