Skip to main content

DebugDisplay

Struct DebugDisplay 

Source
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>

Source

pub const fn new(value: &'value T) -> Self

Wraps a borrowed value without formatting or allocating.

§Parameters
  • value: Source whose Debug formatter is deferred until needed.
§Returns

A borrowed adapter that has not inspected or formatted the source.

Trait Implementations§

Source§

impl<'value, T: Clone + ?Sized> Clone for DebugDisplay<'value, T>

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl<'value, T: Copy + ?Sized> Copy for DebugDisplay<'value, T>

Source§

impl<T> Display for DebugDisplay<'_, T>
where T: Debug + ?Sized,

Source§

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>
where &'value T: Freeze, T: ?Sized,

§

impl<'value, T> RefUnwindSafe for DebugDisplay<'value, T>

§

impl<'value, T> Send for DebugDisplay<'value, T>
where &'value T: Send, T: ?Sized,

§

impl<'value, T> Sync for DebugDisplay<'value, T>
where &'value T: Sync, T: ?Sized,

§

impl<'value, T> Unpin for DebugDisplay<'value, T>
where &'value T: Unpin, T: ?Sized,

§

impl<'value, T> UnsafeUnpin for DebugDisplay<'value, T>

§

impl<'value, T> UnwindSafe for DebugDisplay<'value, T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.