Struct http_types::server::Allow [−][src]
pub struct Allow { /* fields omitted */ }List the set of methods supported by a resource.
Specifications
Examples
use http_types::{Method, Response}; use http_types::server::Allow; let mut allow = Allow::new(); allow.insert(Method::Put); allow.insert(Method::Post); let mut res = Response::new(200); allow.apply(&mut res); let allow = Allow::from_headers(res)?.unwrap(); assert!(allow.contains(Method::Put)); assert!(allow.contains(Method::Post));
Implementations
impl Allow[src]
impl Allow[src]pub fn new() -> Self[src]
Create a new instance of Allow.
pub fn from_headers(headers: impl AsRef<Headers>) -> Result<Option<Self>>[src]
Create a new instance from headers.
pub fn apply(&self, headers: impl AsMut<Headers>)[src]
Sets the Allow header.
pub fn name(&self) -> HeaderName[src]
Get the HeaderName.
pub fn value(&self) -> HeaderValue[src]
Get the HeaderValue.
pub fn insert(&mut self, method: Method)[src]
Push a method into the set of methods.
pub fn iter(&self) -> Iter<'_>ⓘ[src]
An iterator visiting all server entries.
pub fn contains(&self, method: Method) -> bool[src]
Returns true if the header contains the Method.
Trait Implementations
impl IntoIterator for Allow[src]
impl IntoIterator for Allow[src]impl<'a> IntoIterator for &'a Allow[src]
impl<'a> IntoIterator for &'a Allow[src]impl ToHeaderValues for Allow[src]
impl ToHeaderValues for Allow[src]type Iter = IntoIter<HeaderValue>
Returned iterator over header values which this type may correspond to.
fn to_header_values(&self) -> Result<Self::Iter>[src]
Auto Trait Implementations
impl RefUnwindSafe for Allow
impl RefUnwindSafe for Allowimpl UnwindSafe for Allow
impl UnwindSafe for Allow