pub struct OpenApiDiagnostic {
pub kind: DiagnosticKind,
pub pointer: Option<String>,
pub source_preview: Option<String>,
pub context: Option<String>,
pub line: Option<usize>,
}Expand description
parsing the human-readable error string.
Fields§
§kind: DiagnosticKindMachine-readable classification of the issue.
pointer: Option<String>JSON pointer into the document where the issue was detected.
source_preview: Option<String>A snippet of the document at the pointer location.
context: Option<String>Human-readable context when there is no pointer (e.g. "parameter \foo`“`).
line: Option<usize>Approximate 1-based source line for the node at pointer, when resolvable.
Implementations§
Source§impl OpenApiDiagnostic
impl OpenApiDiagnostic
pub fn from_pointer( kind: DiagnosticKind, pointer: impl Into<String>, source_preview: Option<String>, line: Option<usize>, ) -> Self
pub fn from_named_context( kind: DiagnosticKind, context: impl Into<String>, ) -> Self
pub fn simple(kind: DiagnosticKind) -> Self
Sourcepub fn note(&self) -> Option<&str>
pub fn note(&self) -> Option<&str>
Returns the human-readable note text for this diagnostic, if any.
Sourcepub fn classify(&self) -> (&'static str, String)
pub fn classify(&self) -> (&'static str, String)
Returns the corpus (kind, feature) classification for this diagnostic.
This is the canonical mapping from DiagnosticKind to the string
identifiers used in corpus reports. Keeping it here means adding a new
variant produces a compile error at the definition site.
pub fn unsupported_kind_for_pointer( pointer: Option<&str>, feature: &str, ) -> &'static str
Trait Implementations§
Source§impl Clone for OpenApiDiagnostic
impl Clone for OpenApiDiagnostic
Source§fn clone(&self) -> OpenApiDiagnostic
fn clone(&self) -> OpenApiDiagnostic
Returns a duplicate of the value. Read more
1.0.0 · 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 OpenApiDiagnostic
impl Debug for OpenApiDiagnostic
Source§impl Display for OpenApiDiagnostic
impl Display for OpenApiDiagnostic
Source§impl Error for OpenApiDiagnostic
impl Error for OpenApiDiagnostic
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()
Auto Trait Implementations§
impl Freeze for OpenApiDiagnostic
impl RefUnwindSafe for OpenApiDiagnostic
impl Send for OpenApiDiagnostic
impl Sync for OpenApiDiagnostic
impl Unpin for OpenApiDiagnostic
impl UnsafeUnpin for OpenApiDiagnostic
impl UnwindSafe for OpenApiDiagnostic
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