MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / from_str

Method from_str

crates/openshell-ocsf/src/enums/http_method.rs:59–72  ·  view source on GitHub ↗

Parse a method string into a typed variant (case-insensitive).

(s: &str)

Source from the content-addressed store, hash-verified

57
58 /// Parse a method string into a typed variant (case-insensitive).
59 fn from_str(s: &str) -> Result<Self, Self::Err> {
60 Ok(match s.to_uppercase().as_str() {
61 "OPTIONS" => Self::Options,
62 "GET" => Self::Get,
63 "HEAD" => Self::Head,
64 "POST" => Self::Post,
65 "PUT" => Self::Put,
66 "DELETE" => Self::Delete,
67 "TRACE" => Self::Trace,
68 "CONNECT" => Self::Connect,
69 "PATCH" => Self::Patch,
70 _ => Self::Other(s.to_string()),
71 })
72 }
73}
74
75impl Serialize for HttpMethod {

Callers

nothing calls this directly

Calls 1

as_strMethod · 0.45

Tested by

no test coverage detected