Lines Matching refs:Method

45 pub struct Method(Inner);  struct
113 impl Method { implementation
115 pub const GET: Method = Method(Get);
118 pub const POST: Method = Method(Post);
121 pub const PUT: Method = Method(Put);
124 pub const DELETE: Method = Method(Delete);
127 pub const HEAD: Method = Method(Head);
130 pub const OPTIONS: Method = Method(Options);
133 pub const CONNECT: Method = Method(Connect);
136 pub const PATCH: Method = Method(Patch);
139 pub const TRACE: Method = Method(Trace);
142 pub fn from_bytes(src: &[u8]) -> Result<Method, InvalidMethod> { in from_bytes() argument
146 b"GET" => Ok(Method(Get)), in from_bytes()
147 b"PUT" => Ok(Method(Put)), in from_bytes()
148 _ => Method::extension_inline(src), in from_bytes()
151 b"POST" => Ok(Method(Post)), in from_bytes()
152 b"HEAD" => Ok(Method(Head)), in from_bytes()
153 _ => Method::extension_inline(src), in from_bytes()
156 b"PATCH" => Ok(Method(Patch)), in from_bytes()
157 b"TRACE" => Ok(Method(Trace)), in from_bytes()
158 _ => Method::extension_inline(src), in from_bytes()
161 b"DELETE" => Ok(Method(Delete)), in from_bytes()
162 _ => Method::extension_inline(src), in from_bytes()
165 b"OPTIONS" => Ok(Method(Options)), in from_bytes()
166 b"CONNECT" => Ok(Method(Connect)), in from_bytes()
167 _ => Method::extension_inline(src), in from_bytes()
171 Method::extension_inline(src) in from_bytes()
177 Ok(Method(ExtensionAllocated(data.into_boxed_slice()))) in from_bytes()
183 fn extension_inline(src: &[u8]) -> Result<Method, InvalidMethod> { in extension_inline() argument
188 Ok(Method(ExtensionInline(data, src.len() as u8))) in extension_inline()
250 impl AsRef<str> for Method { implementation
257 impl<'a> PartialEq<&'a Method> for Method { implementation
259 fn eq(&self, other: &&'a Method) -> bool { in eq()
264 impl<'a> PartialEq<Method> for &'a Method { implementation
266 fn eq(&self, other: &Method) -> bool { in eq()
271 impl PartialEq<str> for Method { implementation
278 impl PartialEq<Method> for str {
280 fn eq(&self, other: &Method) -> bool { in eq()
285 impl<'a> PartialEq<&'a str> for Method { implementation
292 impl<'a> PartialEq<Method> for &'a str {
294 fn eq(&self, other: &Method) -> bool { in eq()
299 impl fmt::Debug for Method { implementation
305 impl fmt::Display for Method { implementation
311 impl Default for Method { implementation
313 fn default() -> Method { in default()
314 Method::GET in default()
318 impl<'a> From<&'a Method> for Method { implementation
320 fn from(t: &'a Method) -> Self { in from()
325 impl<'a> TryFrom<&'a [u8]> for Method { implementation
330 Method::from_bytes(t) in try_from()
334 impl<'a> TryFrom<&'a str> for Method { implementation
343 impl FromStr for Method { implementation
376 assert_eq!(Method::GET, Method::GET); in test_method_eq()
377 assert_eq!(Method::GET, "GET"); in test_method_eq()
378 assert_eq!(&Method::GET, "GET"); in test_method_eq()
380 assert_eq!("GET", Method::GET); in test_method_eq()
381 assert_eq!("GET", &Method::GET); in test_method_eq()
383 assert_eq!(&Method::GET, Method::GET); in test_method_eq()
384 assert_eq!(Method::GET, &Method::GET); in test_method_eq()
389 assert!(Method::from_str("").is_err()); in test_invalid_method()
390 assert!(Method::from_bytes(b"").is_err()); in test_invalid_method()
395 assert!(Method::OPTIONS.is_idempotent()); in test_is_idempotent()
396 assert!(Method::GET.is_idempotent()); in test_is_idempotent()
397 assert!(Method::PUT.is_idempotent()); in test_is_idempotent()
398 assert!(Method::DELETE.is_idempotent()); in test_is_idempotent()
399 assert!(Method::HEAD.is_idempotent()); in test_is_idempotent()
400 assert!(Method::TRACE.is_idempotent()); in test_is_idempotent()
402 assert!(!Method::POST.is_idempotent()); in test_is_idempotent()
403 assert!(!Method::CONNECT.is_idempotent()); in test_is_idempotent()
404 assert!(!Method::PATCH.is_idempotent()); in test_is_idempotent()