Skip to main content

DiagnosticView

Struct DiagnosticView 

Source
pub struct DiagnosticView<'a> { /* private fields */ }
Expand description

A borrowed controlled-diagnostics projection of one descriptor-validated context.

DiagnosticView exposes descriptor-approved diagnostic fields and key-only secret-presence markers for operational diagnostics. It never exposes source errors, caller locations, or backtraces and must not be serialized into public protocol responses. Like PublicErrorView, it borrows its inputs and performs no allocation after ErrorContext has been constructed.

Implementations§

Source§

impl<'a> DiagnosticView<'a>

Source

pub fn try_new( descriptor: &'static ErrorDescriptor, context: &'a ErrorContext, ) -> Result<Self, ViewContextViolation>

Validates context against descriptor and creates a controlled diagnostic view.

§Errors

Returns ViewContextViolation for the first retained context field that is undeclared or has a different complete schema.

Source

pub const fn code(&self) -> ErrorCode

Returns the stable catalog code.

Source

pub const fn message(&self) -> &'static str

Returns the descriptor’s fixed public message.

Source

pub const fn condition(&self) -> CanonicalCondition

Returns the descriptor’s protocol-independent canonical condition.

Source

pub const fn severity(&self) -> ErrorSeverity

Returns the descriptor’s operational severity.

Source

pub const fn recovery_hint(&self) -> RecoveryHint

Returns the descriptor’s recovery advice.

Source

pub fn fields(&self) -> DiagnosticFields<'a> ⓘ

Iterates present public, diagnostic, and redacted secret-presence fields.

Source

pub const fn projection(&self) -> ProjectionSpec

Returns descriptor-owned boundary projections.

Source

pub const fn is_truncated(&self) -> bool

Returns whether context construction normalized, discarded, or truncated a value.

Trait Implementations§

Source§

impl Debug for DiagnosticView<'_>

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for DiagnosticView<'a>

§

impl<'a> RefUnwindSafe for DiagnosticView<'a>

§

impl<'a> Send for DiagnosticView<'a>

§

impl<'a> Sync for DiagnosticView<'a>

§

impl<'a> Unpin for DiagnosticView<'a>

§

impl<'a> UnsafeUnpin for DiagnosticView<'a>

§

impl<'a> UnwindSafe for DiagnosticView<'a>

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> 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, 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.