pub struct RedactionScope { /* private fields */ }Expand description
A set of registered secrets: what an agent’s runs redact, beside its
hooks’ Redacters.
RedactionScope::process is the process-wide set, every agent’s
default (crate::AgentBuilder::redaction_scope) and the daemon’s: a
value registered there is hidden from every run in the process and is
never removed. RedactionScope::isolated is a set of its own, for an
agent (or a test) whose secrets must not reach other agents’ runs, and
whose runs must not depend on what other code registered. Give the same
scope to everything that registers for that agent: its secret store and
its Redactor hook. Cheap to clone; clones share the set.
Implementations§
Source§impl RedactionScope
impl RedactionScope
Sourcepub fn process() -> RedactionScope
pub fn process() -> RedactionScope
The process-wide set.
Sourcepub fn isolated() -> RedactionScope
pub fn isolated() -> RedactionScope
A new, empty set shared with no one but its clones.
Sourcepub fn is_process(&self) -> bool
pub fn is_process(&self) -> bool
Whether this is the process-wide set.
Sourcepub fn register(&self, value: &str) -> Result<(), SecretTooShort>
pub fn register(&self, value: &str) -> Result<(), SecretTooShort>
Redact value from everything this scope’s runs send out. Errors
(and registers nothing) for a value under MIN_SECRET_CHARS.
Sourcepub fn redact<'a>(&self, text: &'a str) -> Cow<'a, str>
pub fn redact<'a>(&self, text: &'a str) -> Cow<'a, str>
text with every secret in this scope replaced by
[REDACTED:secret].
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Clone for RedactionScope
impl Clone for RedactionScope
Source§fn clone(&self) -> RedactionScope
fn clone(&self) -> RedactionScope
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 RedactionScope
Never the values: which set it is and how many it holds.
impl Debug for RedactionScope
Never the values: which set it is and how many it holds.
Source§impl Default for RedactionScope
The process-wide set, as for an agent that names none.
impl Default for RedactionScope
The process-wide set, as for an agent that names none.
Source§fn default() -> RedactionScope
fn default() -> RedactionScope
Auto Trait Implementations§
impl Forget for RedactionScope
impl Freeze for RedactionScope
impl Move for RedactionScope
impl RefUnwindSafe for RedactionScope
impl Send for RedactionScope
impl Sync for RedactionScope
impl Unpin for RedactionScope
impl UnsafeUnpin for RedactionScopewhere
*const ArcInner<RwLock<Vec<String>>> is !null: UnsafeUnpin,
PhantomData<ArcInner<RwLock<Vec<String>>>>: UnsafeUnpin,
impl UnwindSafe for RedactionScope
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more