[][src]Struct tide::http::security::TimingAllowOrigin

pub struct TimingAllowOrigin { /* fields omitted */ }

Specify origins that are allowed to see values via the Resource Timing API.

Examples

use http_types::{Response, Url};
use http_types::security::TimingAllowOrigin;

let mut origins = TimingAllowOrigin::new();
origins.push(Url::parse("https://example.com")?);

let mut res = Response::new(200);
origins.apply(&mut res);

let origins = TimingAllowOrigin::from_headers(res)?.unwrap();
let origin = origins.iter().next().unwrap();
assert_eq!(origin, &Url::parse("https://example.com")?);

Implementations

impl TimingAllowOrigin[src]

pub fn new() -> TimingAllowOrigin[src]

Create a new instance of AllowOrigin.

pub fn from_headers(
    headers: impl AsRef<Headers>
) -> Result<Option<TimingAllowOrigin>, Error>
[src]

Create an instance of AllowOrigin from a Headers instance.

Implementation note

A header value of "null" is treated the same as if no header was sent.

pub fn push(&mut self, origin: impl Into<Url>)[src]

Append an origin to the list of origins.

pub fn apply(&self, headers: impl AsMut<Headers>)[src]

Insert a HeaderName + HeaderValue pair into a Headers instance.

pub fn name(&self) -> HeaderName[src]

Get the HeaderName.

pub fn value(&self) -> HeaderValue[src]

Get the HeaderValue.

pub fn wildcard(&self) -> bool[src]

Returns true if a wildcard directive was set.

pub fn set_wildcard(&mut self, wildcard: bool)[src]

Set the wildcard directive.

pub fn iter(&self) -> Iter<'_>[src]

An iterator visiting all server timings.

pub fn iter_mut(&mut self) -> IterMut<'_>[src]

An iterator visiting all server timings.

Trait Implementations

impl Clone for TimingAllowOrigin[src]

impl Debug for TimingAllowOrigin[src]

impl Eq for TimingAllowOrigin[src]

impl<'a> IntoIterator for &'a mut TimingAllowOrigin[src]

type Item = &'a mut Url

The type of the elements being iterated over.

type IntoIter = IterMut<'a>

Which kind of iterator are we turning this into?

impl<'a> IntoIterator for &'a TimingAllowOrigin[src]

type Item = &'a Url

The type of the elements being iterated over.

type IntoIter = Iter<'a>

Which kind of iterator are we turning this into?

impl IntoIterator for TimingAllowOrigin[src]

type Item = Url

The type of the elements being iterated over.

type IntoIter = IntoIter

Which kind of iterator are we turning this into?

impl PartialEq<TimingAllowOrigin> for TimingAllowOrigin[src]

impl StructuralEq for TimingAllowOrigin[src]

impl StructuralPartialEq for TimingAllowOrigin[src]

impl ToHeaderValues for TimingAllowOrigin[src]

type Iter = IntoIter<HeaderValue>

Returned iterator over header values which this type may correspond to.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,