Struct http_types::security::TimingAllowOrigin
source · pub struct TimingAllowOrigin { /* private fields */ }
Expand description
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§
source§impl TimingAllowOrigin
impl TimingAllowOrigin
sourcepub fn from_headers(headers: impl AsRef<Headers>) -> Result<Option<Self>>
pub fn from_headers(headers: impl AsRef<Headers>) -> Result<Option<Self>>
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.
sourcepub fn apply(&self, headers: impl AsMut<Headers>)
pub fn apply(&self, headers: impl AsMut<Headers>)
Insert a HeaderName
+ HeaderValue
pair into a Headers
instance.
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
.
sourcepub fn set_wildcard(&mut self, wildcard: bool)
pub fn set_wildcard(&mut self, wildcard: bool)
Set the wildcard directive.
Trait Implementations§
source§impl Clone for TimingAllowOrigin
impl Clone for TimingAllowOrigin
source§fn clone(&self) -> TimingAllowOrigin
fn clone(&self) -> TimingAllowOrigin
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for TimingAllowOrigin
impl Debug for TimingAllowOrigin
source§impl<'a> IntoIterator for &'a TimingAllowOrigin
impl<'a> IntoIterator for &'a TimingAllowOrigin
source§impl<'a> IntoIterator for &'a mut TimingAllowOrigin
impl<'a> IntoIterator for &'a mut TimingAllowOrigin
source§impl IntoIterator for TimingAllowOrigin
impl IntoIterator for TimingAllowOrigin
source§impl PartialEq<TimingAllowOrigin> for TimingAllowOrigin
impl PartialEq<TimingAllowOrigin> for TimingAllowOrigin
source§fn eq(&self, other: &TimingAllowOrigin) -> bool
fn eq(&self, other: &TimingAllowOrigin) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl ToHeaderValues for TimingAllowOrigin
impl ToHeaderValues for TimingAllowOrigin
§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
.impl Eq for TimingAllowOrigin
impl StructuralEq for TimingAllowOrigin
impl StructuralPartialEq for TimingAllowOrigin
Auto Trait Implementations§
impl RefUnwindSafe for TimingAllowOrigin
impl Send for TimingAllowOrigin
impl Sync for TimingAllowOrigin
impl Unpin for TimingAllowOrigin
impl UnwindSafe for TimingAllowOrigin
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