pub struct Diagnostic { /* private fields */ }Expand description
A recoverable parsing finding returned with a partial crate::Disassembly.
Implementations§
Source§impl Diagnostic
impl Diagnostic
Sourcepub fn severity(&self) -> DiagnosticSeverity
pub fn severity(&self) -> DiagnosticSeverity
Returns the severity assigned to this finding.
Examples found in repository?
examples/disassemble.rs (line 72)
64fn print_diagnostic(diagnostic: &Diagnostic) {
65 let offset = diagnostic
66 .offset()
67 .map(|offset| format!(" at code offset 0x{offset:04x}"))
68 .unwrap_or_default();
69
70 eprintln!(
71 "diagnostic: {:?} in {:?}{offset}: {}",
72 diagnostic.severity(),
73 diagnostic.stage(),
74 diagnostic.message()
75 );
76}Sourcepub fn stage(&self) -> DiagnosticStage
pub fn stage(&self) -> DiagnosticStage
Returns the class-file area where this finding occurred.
Examples found in repository?
examples/disassemble.rs (line 73)
64fn print_diagnostic(diagnostic: &Diagnostic) {
65 let offset = diagnostic
66 .offset()
67 .map(|offset| format!(" at code offset 0x{offset:04x}"))
68 .unwrap_or_default();
69
70 eprintln!(
71 "diagnostic: {:?} in {:?}{offset}: {}",
72 diagnostic.severity(),
73 diagnostic.stage(),
74 diagnostic.message()
75 );
76}Sourcepub fn offset(&self) -> Option<usize>
pub fn offset(&self) -> Option<usize>
Returns the reported byte offset when the decoder supplied one.
Offsets for bytecode findings are relative to the method’s code array.
Examples found in repository?
examples/disassemble.rs (line 66)
64fn print_diagnostic(diagnostic: &Diagnostic) {
65 let offset = diagnostic
66 .offset()
67 .map(|offset| format!(" at code offset 0x{offset:04x}"))
68 .unwrap_or_default();
69
70 eprintln!(
71 "diagnostic: {:?} in {:?}{offset}: {}",
72 diagnostic.severity(),
73 diagnostic.stage(),
74 diagnostic.message()
75 );
76}Sourcepub fn message(&self) -> &str
pub fn message(&self) -> &str
Returns the human-readable decoder message.
Examples found in repository?
examples/disassemble.rs (line 74)
64fn print_diagnostic(diagnostic: &Diagnostic) {
65 let offset = diagnostic
66 .offset()
67 .map(|offset| format!(" at code offset 0x{offset:04x}"))
68 .unwrap_or_default();
69
70 eprintln!(
71 "diagnostic: {:?} in {:?}{offset}: {}",
72 diagnostic.severity(),
73 diagnostic.stage(),
74 diagnostic.message()
75 );
76}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
impl Eq for Diagnostic
Source§impl PartialEq for Diagnostic
impl PartialEq for Diagnostic
impl StructuralPartialEq for Diagnostic
Auto Trait Implementations§
impl Freeze for Diagnostic
impl RefUnwindSafe for Diagnostic
impl Send for Diagnostic
impl Sync for Diagnostic
impl Unpin for Diagnostic
impl UnsafeUnpin for Diagnostic
impl UnwindSafe for Diagnostic
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