[−][src]Struct tide::http::server::allow::Allow
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]
pub fn new() -> Allow
[src]
Create a new instance of Allow
.
pub fn from_headers(
headers: impl AsRef<Headers>
) -> Result<Option<Allow>, Error>
[src]
headers: impl AsRef<Headers>
) -> Result<Option<Allow>, Error>
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 Debug for Allow
[src]
impl IntoIterator for Allow
[src]
type Item = Method
The type of the elements being iterated over.
type IntoIter = IntoIter
Which kind of iterator are we turning this into?
pub fn into_iter(self) -> <Allow as IntoIterator>::IntoIter
[src]
impl<'a> IntoIterator for &'a Allow
[src]
type Item = &'a Method
The type of the elements being iterated over.
type IntoIter = Iter<'a>
Which kind of iterator are we turning this into?
pub fn into_iter(self) -> <&'a Allow as IntoIterator>::IntoIter
[src]
impl ToHeaderValues for Allow
[src]
type Iter = IntoIter<HeaderValue>
Returned iterator over header values which this type may correspond to.
pub fn to_header_values(&self) -> Result<<Allow as ToHeaderValues>::Iter, Error>
[src]
Auto Trait Implementations
impl RefUnwindSafe for Allow
[src]
impl Send for Allow
[src]
impl Sync for Allow
[src]
impl Unpin for Allow
[src]
impl UnwindSafe for Allow
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,