Struct lib_ruby_parser::Diagnostic
source · #[repr(C)]pub struct Diagnostic {
pub level: ErrorLevel,
pub message: DiagnosticMessage,
pub loc: Loc,
}
Expand description
Diagnostic message that comes from the parser when there’s an error or warning
Fields§
§level: ErrorLevel
Level of the diagnostic (error or warnings)
message: DiagnosticMessage
Message of the diagnostic
loc: Loc
Location of the diagnostic
Implementations§
source§impl Diagnostic
impl Diagnostic
sourcepub fn render_message(&self) -> String
pub fn render_message(&self) -> String
Returns rendered message
sourcepub fn render(&self, input: &DecodedInput) -> Option<String>
pub fn render(&self, input: &DecodedInput) -> Option<String>
Renders all data into a single String, produces an output like:
(test.rb):1:5: error: unexpected END_OF_INPUT
(test.rb):1: foo++
(test.rb):1: ^
sourcepub fn is_warning(&self) -> bool
pub fn is_warning(&self) -> bool
Returns true
if level of the diagnostic is Warning
Trait Implementations§
source§impl Clone for Diagnostic
impl Clone for Diagnostic
source§fn clone(&self) -> Diagnostic
fn clone(&self) -> Diagnostic
Returns a copy 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 Diagnostic
impl Debug for Diagnostic
source§impl PartialEq for Diagnostic
impl PartialEq for Diagnostic
source§fn eq(&self, other: &Diagnostic) -> bool
fn eq(&self, other: &Diagnostic) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Eq 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 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