pub struct Diagnostic(/* private fields */);Expand description
An immutable native diagnostic that retains its actual typed cause and context independently of its human-readable message.
Implementations§
Source§impl Diagnostic
impl Diagnostic
Sourcepub fn new(kind: DiagnosticKind, message: impl Into<String>) -> Diagnostic
pub fn new(kind: DiagnosticKind, message: impl Into<String>) -> Diagnostic
Create a diagnostic with a known reason.
Sourcepub fn with_context(self, context: ErrorContext) -> Diagnostic
pub fn with_context(self, context: ErrorContext) -> Diagnostic
Attach known context.
Sourcepub fn with_prefix(self, prefix: &str) -> Diagnostic
pub fn with_prefix(self, prefix: &str) -> Diagnostic
Add human-readable context without replacing the typed reason.
Sourcepub fn kind(&self) -> &DiagnosticKind
pub fn kind(&self) -> &DiagnosticKind
Actual typed cause.
Sourcepub fn context(&self) -> &ErrorContext
pub fn context(&self) -> &ErrorContext
Actual known failure context.
Trait Implementations§
Source§impl Clone for Diagnostic
impl Clone for Diagnostic
Source§fn clone(&self) -> Diagnostic
fn clone(&self) -> Diagnostic
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 moreSource§impl Debug for Diagnostic
impl Debug for Diagnostic
Source§impl Display for Diagnostic
impl Display for Diagnostic
impl Eq for Diagnostic
Source§impl Error for Diagnostic
impl Error for Diagnostic
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<&str> for Diagnostic
impl From<&str> for Diagnostic
Source§fn from(message: &str) -> Diagnostic
fn from(message: &str) -> Diagnostic
Converts to this type from the input type.
Source§impl From<String> for Diagnostic
impl From<String> for Diagnostic
Source§fn from(message: String) -> Diagnostic
fn from(message: String) -> Diagnostic
Converts to this type from the input type.
Source§impl PartialEq for Diagnostic
impl PartialEq for Diagnostic
impl StructuralPartialEq for Diagnostic
Auto Trait Implementations§
impl Forget for Diagnostic
impl Freeze for Diagnosticwhere
*const ArcInner<DiagnosticData> is !null: Freeze,
PhantomData<ArcInner<DiagnosticData>>: Freeze,
impl Move for Diagnostic
impl RefUnwindSafe for Diagnostic
impl Send for Diagnostic
impl Sync for Diagnostic
impl Unpin for Diagnostic
impl UnsafeUnpin for Diagnosticwhere
*const ArcInner<DiagnosticData> is !null: UnsafeUnpin,
PhantomData<ArcInner<DiagnosticData>>: UnsafeUnpin,
impl UnwindSafe for Diagnosticwhere
Arc<DiagnosticData>: UnwindSafe,
Blanket Implementations§
impl<T> Allocation for T
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.