#[non_exhaustive]pub struct WebAccessPolicy {
pub enabled: bool,
pub mode: String,
pub rate_limit_per_minute: u32,
pub max_concurrent_fetches: u32,
pub max_result_size_bytes: usize,
pub categories: Vec<WebCategory>,
}Expand description
Domain-level web access policy.
§Stability
This struct is #[non_exhaustive] — new fields may be added in minor releases.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.enabled: boolMaster switch — when false, all web access is allowed
mode: StringPolicy mode: “permissive” (allow unless blocked) or “strict” (deny unless allowlisted)
rate_limit_per_minute: u32Per-category rate limit (requests per minute)
max_concurrent_fetches: u32Maximum concurrent fetches
max_result_size_bytes: usizeMaximum result size in bytes
categories: Vec<WebCategory>Ordered category definitions
Implementations§
Source§impl WebAccessPolicy
impl WebAccessPolicy
Sourcepub fn disabled() -> Self
pub fn disabled() -> Self
A policy that is disabled — all web access is allowed.
This is the safe default for existing deployments; users opt into
domain filtering by setting enabled = true in their configuration.
Sourcepub fn is_strict(&self) -> bool
pub fn is_strict(&self) -> bool
Whether the policy operates in strict mode (deny unless explicitly allowlisted).
Sourcepub fn classify(&self, domain: &str) -> &WebCategory
pub fn classify(&self, domain: &str) -> &WebCategory
Classify a domain into a category. Returns the first category whose allowlist or blocklist matches, or the final (uncategorized) category.
Sourcepub fn is_allowed(&self, domain: &str) -> (bool, String)
pub fn is_allowed(&self, domain: &str) -> (bool, String)
Check whether a domain is allowed by policy.
Returns (allowed, reason) where reason is the category name on allow
(or “policy_disabled”) and a human-readable denial reason on deny.
Trait Implementations§
Source§impl Clone for WebAccessPolicy
impl Clone for WebAccessPolicy
Source§fn clone(&self) -> WebAccessPolicy
fn clone(&self) -> WebAccessPolicy
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 WebAccessPolicy
impl Debug for WebAccessPolicy
Source§impl Default for WebAccessPolicy
impl Default for WebAccessPolicy
Source§impl<'de> Deserialize<'de> for WebAccessPolicy
impl<'de> Deserialize<'de> for WebAccessPolicy
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>,
Auto Trait Implementations§
impl Freeze for WebAccessPolicy
impl RefUnwindSafe for WebAccessPolicy
impl Send for WebAccessPolicy
impl Sync for WebAccessPolicy
impl Unpin for WebAccessPolicy
impl UnsafeUnpin for WebAccessPolicy
impl UnwindSafe for WebAccessPolicy
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
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request