pub struct Allow { /* private fields */ }
Expand description
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§
Source§impl Allow
impl Allow
Sourcepub fn from_headers(headers: impl AsRef<Headers>) -> Result<Option<Self>>
pub fn from_headers(headers: impl AsRef<Headers>) -> Result<Option<Self>>
Create a new instance from headers.
Sourcepub fn name(&self) -> HeaderName
pub fn name(&self) -> HeaderName
Get the HeaderName
.
Sourcepub fn value(&self) -> HeaderValue
pub fn value(&self) -> HeaderValue
Get the HeaderValue
.
Trait Implementations§
Source§impl<'a> IntoIterator for &'a Allow
impl<'a> IntoIterator for &'a Allow
Source§impl IntoIterator for Allow
impl IntoIterator for Allow
Source§impl ToHeaderValues for Allow
impl ToHeaderValues for Allow
Source§type Iter = IntoIter<HeaderValue>
type Iter = IntoIter<HeaderValue>
Returned iterator over header values which this type may correspond to.
Source§fn to_header_values(&self) -> Result<Self::Iter>
fn to_header_values(&self) -> Result<Self::Iter>
Converts this object to an iterator of resolved
HeaderValues
.Auto Trait Implementations§
impl Freeze for Allow
impl RefUnwindSafe for Allow
impl Send for Allow
impl Sync for Allow
impl Unpin for Allow
impl UnwindSafe for Allow
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more