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 for TimingAllowOrigin
impl PartialEq for TimingAllowOrigin
Source§impl ToHeaderValues for TimingAllowOrigin
impl ToHeaderValues for TimingAllowOrigin
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
.impl Eq for TimingAllowOrigin
impl StructuralPartialEq for TimingAllowOrigin
Auto Trait Implementations§
impl Freeze for TimingAllowOrigin
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