pub struct DebugDisplay<'value, T: ?Sized> { /* private fields */ }Expand description
Presents a borrowed fmt::Debug value through fmt::Display.
This adapter performs no eager allocation or formatting. Passing it to
crate::Redactor::redact_field or crate::RedactedTextComposer::field
lets an opaque high- or secret-sensitivity mask avoid observing the wrapped
value altogether. The wrapped Debug implementation runs only when the
selected policy needs the source representation, such as for pass-through,
disabled, low-, or medium-sensitivity rendering.
§Type Parameters
'value: Lifetime of the borrowed source.T: Source type; its Debug implementation is required when formatting.
§Examples
use qubit_redact::{DebugDisplay, Redactor};
let values = vec!["first", "second"];
let output = Redactor::strict().redact_field("selection", &DebugDisplay::new(&values));
assert_eq!(output.text().as_str(), "<redacted>");Implementations§
Source§impl<'value, T: ?Sized> DebugDisplay<'value, T>
impl<'value, T: ?Sized> DebugDisplay<'value, T>
Trait Implementations§
Source§impl<'value, T: Clone + ?Sized> Clone for DebugDisplay<'value, T>
impl<'value, T: Clone + ?Sized> Clone for DebugDisplay<'value, T>
Source§fn clone(&self) -> DebugDisplay<'value, T>
fn clone(&self) -> DebugDisplay<'value, T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<'value, T: Copy + ?Sized> Copy for DebugDisplay<'value, T>
Source§impl<T> Display for DebugDisplay<'_, T>
impl<T> Display for DebugDisplay<'_, T>
Source§fn fmt(&self, formatter: &mut Formatter<'_>) -> Result
fn fmt(&self, formatter: &mut Formatter<'_>) -> Result
Lazily delegates formatting to the wrapped value’s Debug output.
§Parameters
formatter: Destination formatter receiving the source Debug representation.
§Returns
Success after the wrapped Debug formatter completes.
§Errors
Propagates any error returned by the wrapped Debug implementation or destination.
Auto Trait Implementations§
impl<'value, T> Freeze for DebugDisplay<'value, T>
impl<'value, T> RefUnwindSafe for DebugDisplay<'value, T>
impl<'value, T> Send for DebugDisplay<'value, T>
impl<'value, T> Sync for DebugDisplay<'value, T>
impl<'value, T> Unpin for DebugDisplay<'value, T>
impl<'value, T> UnsafeUnpin for DebugDisplay<'value, T>
impl<'value, T> UnwindSafe for DebugDisplay<'value, T>
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