pub struct SecretsLoadResult {
pub scanner: StreamScanner,
pub warnings: Vec<(usize, SanitizeError)>,
pub allow_patterns: Vec<String>,
}Expand description
Result of loading a secrets file into a StreamScanner.
Returned by StreamScanner::from_encrypted_secrets and
StreamScanner::from_plaintext_secrets.
The #[must_use] attribute guards against silently discarding
allow_patterns, which would cause values that should be suppressed
to be sanitized instead.
§Example
ⓘ
let SecretsLoadResult { scanner, warnings, allow_patterns } =
StreamScanner::from_plaintext_secrets(bytes, None, store, config, vec![])?;
for (idx, err) in &warnings {
eprintln!("secrets entry {idx} failed to compile: {err}");
}
let (allowlist, al_warnings) = AllowlistMatcher::new(allow_patterns).into_parts();
let store = MappingStore::new_with_allowlist(gen, None, Arc::new(allowlist));Fields§
§scanner: StreamScannerThe compiled scanner, ready to use.
warnings: Vec<(usize, SanitizeError)>Secrets-file entries that failed pattern compilation:
(index_in_file, error). A non-empty list means some patterns were
silently skipped and the scanner covers less than the full file.
allow_patterns: Vec<String>Raw strings from kind: allow entries in the secrets file.
Pass these to crate::allowlist::AllowlistMatcher::new and attach
the resulting matcher to a crate::store::MappingStore via
crate::store::MappingStore::new_with_allowlist.
Auto Trait Implementations§
impl !RefUnwindSafe for SecretsLoadResult
impl !UnwindSafe for SecretsLoadResult
impl Freeze for SecretsLoadResult
impl Send for SecretsLoadResult
impl Sync for SecretsLoadResult
impl Unpin for SecretsLoadResult
impl UnsafeUnpin for SecretsLoadResult
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
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>
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