Skip to main content

HttpRedactionPolicyBuilder

Struct HttpRedactionPolicyBuilder 

Source
pub struct HttpRedactionPolicyBuilder { /* private fields */ }
Expand description

Mutable construction state for an HttpRedactionPolicy.

Implementations§

Source§

impl HttpRedactionPolicyBuilder

Source

pub fn new() -> Self

Creates a builder with empty field policies and default HTTP behavior.

§Returns

A builder with fail-closed behavior choices and finite default limits.

Source

pub fn load_default(self) -> Self

Replaces this builder with the current default HTTP policy snapshot.

§Returns

A mutable copy of HttpRedactionPolicy::default.

§Warning

This replaces every builder component, including the header, query, and body policies, behavior choices, and budgets. Call this method before adding application-specific configuration.

Source

pub fn from_policy(policy: &HttpRedactionPolicy) -> Self

Creates a builder by copying a complete immutable HTTP policy.

§Parameters
  • policy - HTTP policy whose fields, behaviors, and budgets are copied.
§Returns

Mutable construction state equivalent to policy.

Source

pub fn header_policy(self, policy: RedactionPolicy) -> Self

Replaces the header-field policy snapshot.

§Parameters
  • policy - Immutable policy used for HTTP headers.
§Returns

The updated builder.

Source

pub fn query_policy(self, policy: RedactionPolicy) -> Self

Replaces the query and form field-policy snapshot.

§Parameters
  • policy - Immutable policy used for query and form fields.
§Returns

The updated builder.

Source

pub fn body_policy(self, policy: RedactionPolicy) -> Self

Replaces the structured-body field-policy snapshot.

§Parameters
  • policy - Immutable policy used for fields inside HTTP bodies.
§Returns

The updated builder.

Source

pub fn raise_header(self, name: &str, level: Sensitivity) -> Self

Raises one header field to at least level.

§Parameters
  • name - Header name to canonicalize.
  • level - Minimum sensitivity level.
§Returns

The updated builder.

Source

pub fn override_header(self, name: &str, level: Sensitivity) -> Self

Replaces one header field’s sensitivity with level.

§Parameters
  • name - Header name to canonicalize.
  • level - Explicit replacement sensitivity.
§Returns

The updated builder.

Source

pub fn allow_header_exact(self, name: &str) -> Self

Allows one exact header name to remain visible.

§Parameters
  • name - Exact header name to allow after canonicalization.
§Returns

The updated builder.

Source

pub fn allow_header_suffix(self, name: &str) -> Self

Allows one header name at token-suffix boundaries.

§Parameters
  • name - Header suffix to allow after canonicalization.
§Returns

The updated builder.

Source

pub fn remove_header_allow_exact(self, name: &str) -> Self

Removes one exact header allow rule.

§Parameters
  • name - Header name whose exact allow rule is removed.
§Returns

The updated builder.

Source

pub fn remove_header_allow_suffix(self, name: &str) -> Self

Removes one token-suffix header allow rule.

§Parameters
  • name - Header suffix whose allow rule is removed.
§Returns

The updated builder.

Source

pub fn clear_header_allow_rules(self) -> Self

Removes every header allow rule.

§Returns

The updated builder.

Source

pub fn raise_query(self, name: &str, level: Sensitivity) -> Self

Raises one query or form field to at least level.

§Parameters
  • name - Query field name to canonicalize.
  • level - Minimum sensitivity level.
§Returns

The updated builder.

Source

pub fn override_query(self, name: &str, level: Sensitivity) -> Self

Replaces one query or form field’s sensitivity with level.

§Parameters
  • name - Query field name to canonicalize.
  • level - Explicit replacement sensitivity.
§Returns

The updated builder.

Source

pub fn allow_query_exact(self, name: &str) -> Self

Allows one exact query or form field name to remain visible.

§Parameters
  • name - Exact query field name to allow after canonicalization.
§Returns

The updated builder.

Source

pub fn allow_query_suffix(self, name: &str) -> Self

Allows one query or form field at token-suffix boundaries.

§Parameters
  • name - Query field suffix to allow after canonicalization.
§Returns

The updated builder.

Source

pub fn remove_query_allow_exact(self, name: &str) -> Self

Removes one exact query or form-field allow rule.

§Parameters
  • name - Query or form-field name whose exact allow rule is removed.
§Returns

The updated builder.

Source

pub fn remove_query_allow_suffix(self, name: &str) -> Self

Removes one token-suffix query or form-field allow rule.

§Parameters
  • name - Query or form-field suffix whose allow rule is removed.
§Returns

The updated builder.

Source

pub fn clear_query_allow_rules(self) -> Self

Removes every query and form-field allow rule.

§Returns

The updated builder.

Source

pub fn raise_body(self, name: &str, level: Sensitivity) -> Self

Raises one structured-body field to at least level.

§Parameters
  • name - Body field name to canonicalize.
  • level - Minimum sensitivity level.
§Returns

The updated builder.

Source

pub fn override_body(self, name: &str, level: Sensitivity) -> Self

Replaces one structured-body field’s sensitivity with level.

§Parameters
  • name - Body field name to canonicalize.
  • level - Explicit replacement sensitivity.
§Returns

The updated builder.

Source

pub fn allow_body_exact(self, name: &str) -> Self

Allows one exact structured-body field name to remain visible.

§Parameters
  • name - Exact body field name to allow after canonicalization.
§Returns

The updated builder.

Source

pub fn allow_body_suffix(self, name: &str) -> Self

Allows one structured-body field at token-suffix boundaries.

§Parameters
  • name - Body field suffix to allow after canonicalization.
§Returns

The updated builder.

Source

pub fn remove_body_allow_exact(self, name: &str) -> Self

Removes one exact structured-body allow rule.

§Parameters
  • name - Body-field name whose exact allow rule is removed.
§Returns

The updated builder.

Source

pub fn remove_body_allow_suffix(self, name: &str) -> Self

Removes one token-suffix structured-body allow rule.

§Parameters
  • name - Body-field suffix whose allow rule is removed.
§Returns

The updated builder.

Source

pub fn clear_body_allow_rules(self) -> Self

Removes every structured-body allow rule.

§Returns

The updated builder.

Source

pub const fn url_path_policy(self, policy: UrlPathPolicy) -> Self

Replaces the URL path visibility choice.

§Parameters
  • policy - Visibility behavior for non-root URL paths.
§Returns

The updated builder.

Source

pub const fn text_body_policy(self, policy: TextBodyPolicy) -> Self

Replaces the opaque text-body visibility choice.

§Parameters
  • policy - Visibility behavior for opaque UTF-8 body text.
§Returns

The updated builder.

Source

pub const fn unkeyed_json_value_policy( self, policy: UnkeyedJsonValuePolicy, ) -> Self

Replaces the unkeyed JSON scalar visibility choice.

§Parameters
  • policy - Visibility behavior for JSON values without field names.
§Returns

The updated builder.

Source

pub const fn body_budget(self, budget: BodyBudget) -> Self

Replaces the finite hard body limits.

§Parameters
  • budget - Previously checked parser-input and output byte limits.
§Returns

The updated builder.

Source

pub fn diagnostic_budget(self, budget: DiagnosticBudget) -> Self

Replaces the finite hard HTTP diagnostic limits.

§Parameters
  • budget - Previously checked diagnostic input and output byte limits.
§Returns

The updated builder.

Source

pub fn build(self) -> Result<HttpRedactionPolicy, PolicyError>

Validates all field rules and builds the complete HTTP policy.

§Returns

A complete immutable HTTP policy snapshot.

§Errors

Returns the first PolicyError found while validating the header, query, and body policy builders in that order.

Trait Implementations§

Source§

impl Clone for HttpRedactionPolicyBuilder

Source§

fn clone(&self) -> HttpRedactionPolicyBuilder

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HttpRedactionPolicyBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for HttpRedactionPolicyBuilder

Source§

fn default() -> Self

Creates the same empty construction state as Self::new.

§Returns

A builder with empty field policies and default HTTP behavior.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.