Struct content_security_policy::Policy
source · pub struct Policy {
pub directive_set: Vec<Directive>,
pub disposition: PolicyDisposition,
pub source: PolicySource,
}
Expand description
A single parsed content security policy.
https://www.w3.org/TR/CSP/#content-security-policy-object
Fields§
§directive_set: Vec<Directive>
§disposition: PolicyDisposition
§source: PolicySource
Implementations§
source§impl Policy
impl Policy
pub fn is_valid(&self) -> bool
sourcepub fn parse(
serialized: &str,
source: PolicySource,
disposition: PolicyDisposition,
) -> Policy
pub fn parse( serialized: &str, source: PolicySource, disposition: PolicyDisposition, ) -> Policy
https://www.w3.org/TR/CSP/#parse-serialized-policy
pub fn contains_a_directive_whose_name_is(&self, directive_name: &str) -> bool
sourcepub fn does_request_violate_policy(&self, request: &Request) -> Violates
pub fn does_request_violate_policy(&self, request: &Request) -> Violates
https://www.w3.org/TR/CSP/#does-request-violate-policy
sourcepub fn does_resource_hint_violate_policy(&self, request: &Request) -> Violates
pub fn does_resource_hint_violate_policy(&self, request: &Request) -> Violates
https://www.w3.org/TR/CSP/#does-resource-hint-violate-policy
Trait Implementations§
source§impl<'de> Deserialize<'de> for Policy
impl<'de> Deserialize<'de> for Policy
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Policy
impl RefUnwindSafe for Policy
impl Send for Policy
impl Sync for Policy
impl Unpin for Policy
impl UnwindSafe for Policy
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)