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>
impl<'a> DiagnosticView<'a>
Sourcepub fn try_new(
descriptor: &'static ErrorDescriptor,
context: &'a ErrorContext,
) -> Result<Self, ViewContextViolation>
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.
Sourcepub const fn condition(&self) -> CanonicalCondition
pub const fn condition(&self) -> CanonicalCondition
Returns the descriptor’s protocol-independent canonical condition.
Sourcepub const fn severity(&self) -> ErrorSeverity
pub const fn severity(&self) -> ErrorSeverity
Returns the descriptor’s operational severity.
Sourcepub const fn recovery_hint(&self) -> RecoveryHint
pub const fn recovery_hint(&self) -> RecoveryHint
Returns the descriptor’s recovery advice.
Sourcepub fn fields(&self) -> DiagnosticFields<'a> ⓘ
pub fn fields(&self) -> DiagnosticFields<'a> ⓘ
Iterates present public, diagnostic, and redacted secret-presence fields.
Sourcepub const fn projection(&self) -> ProjectionSpec
pub const fn projection(&self) -> ProjectionSpec
Returns descriptor-owned boundary projections.
Sourcepub const fn is_truncated(&self) -> bool
pub const fn is_truncated(&self) -> bool
Returns whether context construction normalized, discarded, or truncated a value.