pub struct SourceList { /* private fields */ }Expand description
Ordered list of SourceExpressions — the value of one CSP
directive.
Builder methods come in two flavours: with_* consumes self and
returns Self for chaining; set_* / add
mutate in place.
Implementations§
Source§impl SourceList
impl SourceList
Sourcepub const fn empty() -> SourceList
pub const fn empty() -> SourceList
Empty list — for directives like upgrade-insecure-requests
that carry no source value.
Sourcepub fn none() -> SourceList
pub fn none() -> SourceList
'none'-only list. Per spec must not be combined with any
other source.
Sourcepub fn self_origin() -> SourceList
pub fn self_origin() -> SourceList
'self'-only list. Equivalent to
SourceList::empty().with_self_keyword().
Sourcepub fn as_slice(&self) -> &[SourceExpression]
pub fn as_slice(&self) -> &[SourceExpression]
Borrow the underlying sources in declared (emit) order.
Sourcepub fn iter(&self) -> Iter<'_, SourceExpression>
pub fn iter(&self) -> Iter<'_, SourceExpression>
Iterate sources in declared (emit) order.
Sourcepub fn with(self, expr: SourceExpression) -> SourceList
pub fn with(self, expr: SourceExpression) -> SourceList
Push any source expression and return Self.
Sourcepub fn add(&mut self, expr: SourceExpression) -> &mut SourceList
pub fn add(&mut self, expr: SourceExpression) -> &mut SourceList
Push any source expression in place.
Sourcepub fn with_self_keyword(self) -> SourceList
pub fn with_self_keyword(self) -> SourceList
Append the 'self' keyword.
Sourcepub fn set_self_keyword(&mut self) -> &mut SourceList
pub fn set_self_keyword(&mut self) -> &mut SourceList
Append the 'self' keyword.
Sourcepub fn with_unsafe_inline(self) -> SourceList
pub fn with_unsafe_inline(self) -> SourceList
Append the 'unsafe-inline' keyword.
Sourcepub fn set_unsafe_inline(&mut self) -> &mut SourceList
pub fn set_unsafe_inline(&mut self) -> &mut SourceList
Append the 'unsafe-inline' keyword.
Sourcepub fn with_unsafe_eval(self) -> SourceList
pub fn with_unsafe_eval(self) -> SourceList
Append the 'unsafe-eval' keyword.
Sourcepub fn set_unsafe_eval(&mut self) -> &mut SourceList
pub fn set_unsafe_eval(&mut self) -> &mut SourceList
Append the 'unsafe-eval' keyword.
Sourcepub fn with_strict_dynamic(self) -> SourceList
pub fn with_strict_dynamic(self) -> SourceList
Append the 'strict-dynamic' keyword.
Sourcepub fn set_strict_dynamic(&mut self) -> &mut SourceList
pub fn set_strict_dynamic(&mut self) -> &mut SourceList
Append the 'strict-dynamic' keyword.
Sourcepub fn with_wasm_unsafe_eval(self) -> SourceList
pub fn with_wasm_unsafe_eval(self) -> SourceList
Append the 'wasm-unsafe-eval' keyword.
Sourcepub fn set_wasm_unsafe_eval(&mut self) -> &mut SourceList
pub fn set_wasm_unsafe_eval(&mut self) -> &mut SourceList
Append the 'wasm-unsafe-eval' keyword.
Sourcepub fn with_report_sample(self) -> SourceList
pub fn with_report_sample(self) -> SourceList
Append the 'report-sample' keyword.
Sourcepub fn set_report_sample(&mut self) -> &mut SourceList
pub fn set_report_sample(&mut self) -> &mut SourceList
Append the 'report-sample' keyword.
Sourcepub fn with_wildcard(self) -> SourceList
pub fn with_wildcard(self) -> SourceList
Append the * wildcard.
Sourcepub fn set_wildcard(&mut self) -> &mut SourceList
pub fn set_wildcard(&mut self) -> &mut SourceList
Append the * wildcard.
Sourcepub fn with_data(self) -> SourceList
pub fn with_data(self) -> SourceList
Append the data: scheme.
Sourcepub fn set_data(&mut self) -> &mut SourceList
pub fn set_data(&mut self) -> &mut SourceList
Append the data: scheme.
Sourcepub fn with_blob(self) -> SourceList
pub fn with_blob(self) -> SourceList
Append the blob: scheme.
Sourcepub fn set_blob(&mut self) -> &mut SourceList
pub fn set_blob(&mut self) -> &mut SourceList
Append the blob: scheme.
Sourcepub fn with_scheme(self, scheme: Protocol) -> SourceList
pub fn with_scheme(self, scheme: Protocol) -> SourceList
Append a Protocol as a scheme source (<scheme>:).
Sourcepub fn set_scheme(&mut self, scheme: Protocol) -> &mut SourceList
pub fn set_scheme(&mut self, scheme: Protocol) -> &mut SourceList
Append a Protocol as a scheme source (<scheme>:).
Sourcepub fn with_host(self, host: impl Into<HostSource>) -> SourceList
pub fn with_host(self, host: impl Into<HostSource>) -> SourceList
Append a HostSource (or anything convertible into one —
Domain, a &str via HostSource::try_parse etc.).
Sourcepub fn set_host(&mut self, host: impl Into<HostSource>) -> &mut SourceList
pub fn set_host(&mut self, host: impl Into<HostSource>) -> &mut SourceList
Append a HostSource (or anything convertible into one —
Domain, a &str via HostSource::try_parse etc.).
Sourcepub fn with_domain(self, domain: Domain) -> SourceList
pub fn with_domain(self, domain: Domain) -> SourceList
Append a bare-domain host source (no scheme, port, or path).
Sourcepub fn set_domain(&mut self, domain: Domain) -> &mut SourceList
pub fn set_domain(&mut self, domain: Domain) -> &mut SourceList
Append a bare-domain host source (no scheme, port, or path).
Sourcepub fn with_nonce(self, nonce: impl Into<Cow<'static, str>>) -> SourceList
pub fn with_nonce(self, nonce: impl Into<Cow<'static, str>>) -> SourceList
Append a 'nonce-<base64>' source.
Sourcepub fn set_nonce(
&mut self,
nonce: impl Into<Cow<'static, str>>,
) -> &mut SourceList
pub fn set_nonce( &mut self, nonce: impl Into<Cow<'static, str>>, ) -> &mut SourceList
Append a 'nonce-<base64>' source.
Sourcepub fn with_hash(
self,
algorithm: HashAlgorithm,
value: impl Into<Cow<'static, str>>,
) -> SourceList
pub fn with_hash( self, algorithm: HashAlgorithm, value: impl Into<Cow<'static, str>>, ) -> SourceList
Append a '<algo>-<base64>' source.
Sourcepub fn set_hash(
&mut self,
algorithm: HashAlgorithm,
value: impl Into<Cow<'static, str>>,
) -> &mut SourceList
pub fn set_hash( &mut self, algorithm: HashAlgorithm, value: impl Into<Cow<'static, str>>, ) -> &mut SourceList
Append a '<algo>-<base64>' source.
Trait Implementations§
Source§impl Clone for SourceList
impl Clone for SourceList
Source§fn clone(&self) -> SourceList
fn clone(&self) -> SourceList
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SourceList
impl Debug for SourceList
Source§impl Default for SourceList
impl Default for SourceList
Source§fn default() -> SourceList
fn default() -> SourceList
Source§impl Display for SourceList
impl Display for SourceList
impl Eq for SourceList
Source§impl From<SourceExpression> for SourceList
impl From<SourceExpression> for SourceList
Source§fn from(expr: SourceExpression) -> SourceList
fn from(expr: SourceExpression) -> SourceList
Source§impl<T> FromIterator<T> for SourceListwhere
T: Into<SourceExpression>,
impl<T> FromIterator<T> for SourceListwhere
T: Into<SourceExpression>,
Source§fn from_iter<I>(iter: I) -> SourceListwhere
I: IntoIterator<Item = T>,
fn from_iter<I>(iter: I) -> SourceListwhere
I: IntoIterator<Item = T>,
Source§impl PartialEq for SourceList
impl PartialEq for SourceList
Source§fn eq(&self, other: &SourceList) -> bool
fn eq(&self, other: &SourceList) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for SourceList
Auto Trait Implementations§
impl Freeze for SourceList
impl RefUnwindSafe for SourceList
impl Send for SourceList
impl Sync for SourceList
impl Unpin for SourceList
impl UnsafeUnpin for SourceList
impl UnwindSafe for SourceList
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
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
key and return true if they are equal.Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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>
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>
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 moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
Source§impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
type Error = <U as RamaTryFrom<T, CrateMarker>>::Error
fn rama_try_into(self) -> Result<U, <U as RamaTryFrom<T, CrateMarker>>::Error>
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.