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
impl Allow
impl Allow
pub fn from_headers(
headers: impl AsRef<Headers>
) -> Result<Option<Allow>, Error>
pub fn from_headers(
headers: impl AsRef<Headers>
) -> Result<Option<Allow>, Error>
Create a new instance from headers.
pub fn name(&self) -> HeaderName
pub fn name(&self) -> HeaderName
Get the HeaderName
.
pub fn value(&self) -> HeaderValue
pub fn value(&self) -> HeaderValue
Get the HeaderValue
.
Trait Implementations
impl<'a> IntoIterator for &'a Allow
impl<'a> IntoIterator for &'a Allow
impl IntoIterator for Allow
impl IntoIterator for Allow
impl ToHeaderValues for Allow
impl ToHeaderValues for Allow
type Iter = IntoIter<HeaderValue>
type Iter = IntoIter<HeaderValue>
Returned iterator over header values which this type may correspond to.
fn to_header_values(&self) -> Result<<Allow as ToHeaderValues>::Iter, Error>
fn to_header_values(&self) -> Result<<Allow as ToHeaderValues>::Iter, Error>
Converts this object to an iterator of resolved HeaderValues
.
Auto Trait Implementations
impl RefUnwindSafe for Allow
impl Send for Allow
impl Sync for Allow
impl Unpin for Allow
impl UnwindSafe for Allow
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more