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: PolicySourceImplementations§
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
Trait Implementations§
Auto Trait Implementations§
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