use rskit_util::SecretKeyMatcher;
#[derive(Debug, Clone, Eq, PartialEq, Default)]
pub struct ArgRedaction {
matcher: SecretKeyMatcher,
}
impl ArgRedaction {
#[must_use]
pub fn new() -> Self {
Self::default()
}
#[must_use]
pub fn from_names(names: impl IntoIterator<Item = impl AsRef<str>>) -> Self {
Self {
matcher: SecretKeyMatcher::new(names),
}
}
#[must_use]
pub fn with_name(mut self, name: impl AsRef<str>) -> Self {
self.matcher = self.matcher.with_name(name);
self
}
#[must_use]
pub fn with_names(mut self, names: impl IntoIterator<Item = impl AsRef<str>>) -> Self {
self.matcher = self.matcher.with_names(names);
self
}
#[must_use]
pub fn is_sensitive_arg_name(&self, name: &str) -> bool {
self.matcher.is_secret_key(name)
}
}