Skip to main content

FieldsBuilder

Struct FieldsBuilder 

Source
pub struct FieldsBuilder<'a> { /* private fields */ }
Expand description

Mutable view over the base field policy.

§Examples

use qubit_redact::RedactionPolicy;
use qubit_redact::Sensitivity;

let policy = RedactionPolicy::builder().fields(|fields| {
    fields.secret_sensitive("pin").allow_exact("request_id");
})?.build()?;
assert_eq!(policy.sensitivity_for("pin"), Some(Sensitivity::Secret));

Implementations§

Source§

impl FieldsBuilder<'_>

Source

pub fn low_sensitive(&mut self, field: &str) -> &mut Self

Marks a field as low sensitivity.

Source

pub fn medium_sensitive(&mut self, field: &str) -> &mut Self

Marks a field as medium sensitivity.

Source

pub fn high_sensitive(&mut self, field: &str) -> &mut Self

Marks a field as high sensitivity.

Source

pub fn secret_sensitive(&mut self, field: &str) -> &mut Self

Marks a field as secret sensitivity.

Source

pub fn sensitive(&mut self, level: Sensitivity, field: &str) -> &mut Self

Raises a field’s minimum sensitivity to level.

Source

pub fn matching(&mut self, matching: FieldNameMatching) -> &mut Self

Sets field-name matching for the base policy.

Source

pub fn unknown_field_policy(&mut self, policy: UnknownFieldPolicy) -> &mut Self

Sets the base fallback for unknown fields.

Source

pub fn include_preset(&mut self, preset: SensitiveFieldPreset) -> &mut Self

Includes all fields from a built-in sensitive preset.

Source

pub fn raise(&mut self, field: &str, level: Sensitivity) -> &mut Self

Raises a base field’s minimum sensitivity.

Source

pub fn override_level(&mut self, field: &str, level: Sensitivity) -> &mut Self

Replaces one base field rule without weakening floors.

Source

pub fn allow_exact(&mut self, field: &str) -> &mut Self

Adds a base exact allow rule.

Source

pub fn allow_suffix(&mut self, field: &str) -> &mut Self

Adds a base suffix allow rule.

Source

pub fn remove_allow_exact(&mut self, field: &str) -> &mut Self

Removes a base exact allow rule.

Source

pub fn remove_allow_suffix(&mut self, field: &str) -> &mut Self

Removes a base suffix allow rule.

Source

pub fn clear_allow_rules(&mut self) -> &mut Self

Removes all base allow rules.

Source

pub fn floor(&mut self, floor: RedactionFloor) -> &mut Self

Replaces the base minimum-protection floor.

Source

pub fn disable_floor(&mut self) -> &mut Self

Disables the base floor explicitly.

Source

pub fn mask(&mut self, level: Sensitivity, policy: MaskPolicy) -> &mut Self

Replaces one shared masking level.

Auto Trait Implementations§

§

impl<'a> !UnwindSafe for FieldsBuilder<'a>

§

impl<'a> Freeze for FieldsBuilder<'a>

§

impl<'a> RefUnwindSafe for FieldsBuilder<'a>

§

impl<'a> Send for FieldsBuilder<'a>

§

impl<'a> Sync for FieldsBuilder<'a>

§

impl<'a> Unpin for FieldsBuilder<'a>

§

impl<'a> UnsafeUnpin for FieldsBuilder<'a>

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.