pub struct PermissionsPolicyDirective {
pub name: PermissionsPolicyDirectiveName,
pub allow_list: SmallVec<[AllowlistSource; 4]>,
}Expand description
A single entry in a PermissionsPolicy:
pairs a feature name with the origins allowed to use it.
Construct via Self::deny, Self::allow, or Self::allow_from
— those are the three shapes the spec actually defines.
Note: the PermissionsPolicy struct
itself has per-feature with_deny_* / set_deny_* shortcuts for
the deny-all case (the overwhelmingly common one); reach for these
constructors when you need an actual allow-list.
Fields§
§name: PermissionsPolicyDirectiveName§allow_list: SmallVec<[AllowlistSource; 4]>Empty allow-list serialises to name=() — the deny-all form.
The W3C spec has no None allow-list state, so the deny-all
directive is just an empty list.
Implementations§
Source§impl PermissionsPolicyDirective
impl PermissionsPolicyDirective
Sourcepub fn deny(name: impl Into<PermissionsPolicyDirectiveName>) -> Self
pub fn deny(name: impl Into<PermissionsPolicyDirectiveName>) -> Self
Deny-all directive: name=().
Sourcepub fn allow(
name: impl Into<PermissionsPolicyDirectiveName>,
source: AllowlistSource,
) -> Self
pub fn allow( name: impl Into<PermissionsPolicyDirectiveName>, source: AllowlistSource, ) -> Self
Single-source allow-list: name=(source).
Sourcepub fn allow_from(
name: impl Into<PermissionsPolicyDirectiveName>,
sources: impl IntoIterator<Item = AllowlistSource>,
) -> Self
pub fn allow_from( name: impl Into<PermissionsPolicyDirectiveName>, sources: impl IntoIterator<Item = AllowlistSource>, ) -> Self
Multi-source allow-list: name=(src1 src2 …).
Trait Implementations§
Source§impl Clone for PermissionsPolicyDirective
impl Clone for PermissionsPolicyDirective
Source§fn clone(&self) -> PermissionsPolicyDirective
fn clone(&self) -> PermissionsPolicyDirective
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 PermissionsPolicyDirective
impl Debug for PermissionsPolicyDirective
Source§impl Display for PermissionsPolicyDirective
impl Display for PermissionsPolicyDirective
impl Eq for PermissionsPolicyDirective
Source§impl Hash for PermissionsPolicyDirective
impl Hash for PermissionsPolicyDirective
Source§impl PartialEq for PermissionsPolicyDirective
impl PartialEq for PermissionsPolicyDirective
Source§fn eq(&self, other: &PermissionsPolicyDirective) -> bool
fn eq(&self, other: &PermissionsPolicyDirective) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for PermissionsPolicyDirective
Auto Trait Implementations§
impl Freeze for PermissionsPolicyDirective
impl RefUnwindSafe for PermissionsPolicyDirective
impl Send for PermissionsPolicyDirective
impl Sync for PermissionsPolicyDirective
impl Unpin for PermissionsPolicyDirective
impl UnsafeUnpin for PermissionsPolicyDirective
impl UnwindSafe for PermissionsPolicyDirective
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more