pub struct TranscriptRedactor { /* private fields */ }Expand description
Pattern-based transcript scrubber. Build one with the methods below and
install it with
LiveSessionBuilder::redaction.
use gemini_adk_rs::live::redaction::TranscriptRedactor;
let redactor = TranscriptRedactor::new().card_numbers().long_digits(6);
assert_eq!(
redactor.redact("my card is 4111 1111 1111 1111 ok".into()),
"my card is [card ending 1111] ok"
);Implementations§
Source§impl TranscriptRedactor
impl TranscriptRedactor
Sourcepub fn card_numbers(self) -> Self
pub fn card_numbers(self) -> Self
Redact payment-card numbers: runs of 13–19 digits (spaces and dashes
between groups allowed) that pass a Luhn check, replaced with
[card ending NNNN]. The Luhn check keeps ordinary long numbers —
tracking codes, reference IDs — from being eaten as cards.
Sourcepub fn long_digits(self, min: usize) -> Self
pub fn long_digits(self, min: usize) -> Self
Redact any remaining run of min or more consecutive digits
(one-time passcodes, account numbers), replaced with
[redacted number]. Runs after the card pass, so a card keeps its
[card ending NNNN] form.
Sourcepub fn pattern(self, regex: Regex, replacement: impl Into<String>) -> Self
pub fn pattern(self, regex: Regex, replacement: impl Into<String>) -> Self
Redact a custom pattern with a fixed replacement — national identifiers, internal reference formats, whatever the deployment’s compliance regime names.
Trait Implementations§
Source§impl Debug for TranscriptRedactor
impl Debug for TranscriptRedactor
Source§impl Default for TranscriptRedactor
impl Default for TranscriptRedactor
Source§fn default() -> TranscriptRedactor
fn default() -> TranscriptRedactor
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for TranscriptRedactor
impl RefUnwindSafe for TranscriptRedactor
impl Send for TranscriptRedactor
impl Sync for TranscriptRedactor
impl Unpin for TranscriptRedactor
impl UnwindSafe for TranscriptRedactor
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
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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 more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].