pub struct Streamed { /* private fields */ }Expand description
A text that arrives in pieces, such as a streamed reply, cut where no
secret crosses: what Self::push and Self::finish return, each
redacted on its own, joined, is the pieces joined redacted. It holds back
only what a later piece may still make part of a secret, and at most
16 KiB.
use rig_core::redact::{self, Streamed};
let mut streamed = Streamed::default();
let mut shown = String::new();
for piece in ["export GITHUB_TOKEN=gh", "p_abcdefghijklmnopqrstuvwxyz0123456789\nnext "] {
shown += &redact::text(&streamed.push(piece));
}
shown += &redact::text(&streamed.finish());
assert_eq!(shown, "export GITHUB_TOKEN=[REDACTED]\nnext ");Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Forget for Streamed
impl Freeze for Streamed
impl Move for Streamed
impl RefUnwindSafe for Streamed
impl Send for Streamed
impl Sync for Streamed
impl Unpin for Streamed
impl UnsafeUnpin for Streamed
impl UnwindSafe for Streamed
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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