pub struct JsonParse { /* private fields */ }
Expand description
A utility struct for managing the result of a parser job
Implementations§
Source§impl JsonParse
impl JsonParse
pub fn new(root: JsonSyntaxNode, diagnostics: Vec<ParseDiagnostic>) -> JsonParse
Sourcepub fn syntax(&self) -> JsonSyntaxNode
pub fn syntax(&self) -> JsonSyntaxNode
The syntax node represented by this Parse result
use rome_json_syntax::JsonSyntaxKind;
let parse = parse_json(r#"["a", 1]"#);
// Get the root value
let root_value = parse.tree().value()?;
assert_eq!(root_value.syntax().kind(), JsonSyntaxKind::JSON_ARRAY_VALUE);
Sourcepub fn diagnostics(&self) -> &[ParseDiagnostic]
pub fn diagnostics(&self) -> &[ParseDiagnostic]
Get the diagnostics which occurred when parsing
Sourcepub fn into_diagnostics(self) -> Vec<ParseDiagnostic>
pub fn into_diagnostics(self) -> Vec<ParseDiagnostic>
Get the diagnostics which occurred when parsing
Sourcepub fn has_errors(&self) -> bool
pub fn has_errors(&self) -> bool
Returns true if the parser encountered some errors during the parsing.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for JsonParse
impl RefUnwindSafe for JsonParse
impl !Send for JsonParse
impl !Sync for JsonParse
impl Unpin for JsonParse
impl UnwindSafe for JsonParse
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