pub struct IncorrectKind<'tree> {
pub node: UntypedNode<'tree>,
pub kind: &'static str,
}Expand description
Error when attempting to wrap a node of the wrong kind
Fields§
§node: UntypedNode<'tree>Node attempted to be wrapped
kind: &'static strExpected node kind
Implementations§
Source§impl<'tree> IncorrectKind<'tree>
impl<'tree> IncorrectKind<'tree>
Sourcepub fn new<Node>(node: Node<'tree>) -> IncorrectKind<'tree>where
Node: Node<'tree>,
pub fn new<Node>(node: Node<'tree>) -> IncorrectKind<'tree>where
Node: Node<'tree>,
Create an error for another tree-sitter node when a typed node was expected.
Node is the type of node that was expected.
Sourcepub fn actual_kind(&self) -> &'static str
pub fn actual_kind(&self) -> &'static str
The actual kind of node that we encountered, not kind which is the one we expected.
Sourcepub fn is_missing(&self) -> bool
pub fn is_missing(&self) -> bool
Is the actual node missing?
Sourcepub fn cause(&self) -> IncorrectKindCause
pub fn cause(&self) -> IncorrectKindCause
Whether the node is an error, missing, extra, or is just some other node of unexpected kind.
Typically IncorrectKind comes from an error or missing node. The latter cases (extra or
or other) are more likely to be a bug in the code or the tree-sitter grammar, not the parsed
AST.
Sourcepub fn with_source_range(&self) -> impl Display
pub fn with_source_range(&self) -> impl Display
Print an error message for this with the source range.
The default impl Display prints an error message without the source range.
Trait Implementations§
Source§impl<'tree> Clone for IncorrectKind<'tree>
impl<'tree> Clone for IncorrectKind<'tree>
Source§fn clone(&self) -> IncorrectKind<'tree>
fn clone(&self) -> IncorrectKind<'tree>
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<'tree> Debug for IncorrectKind<'tree>
impl<'tree> Debug for IncorrectKind<'tree>
Source§impl Display for IncorrectKind<'_>
impl Display for IncorrectKind<'_>
Source§impl Error for IncorrectKind<'_>
impl Error for IncorrectKind<'_>
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<'tree> Hash for IncorrectKind<'tree>
impl<'tree> Hash for IncorrectKind<'tree>
Source§impl<'tree> PartialEq for IncorrectKind<'tree>
impl<'tree> PartialEq for IncorrectKind<'tree>
impl<'tree> Copy for IncorrectKind<'tree>
impl<'tree> Eq for IncorrectKind<'tree>
impl<'tree> StructuralPartialEq for IncorrectKind<'tree>
Auto Trait Implementations§
impl<'tree> Freeze for IncorrectKind<'tree>
impl<'tree> RefUnwindSafe for IncorrectKind<'tree>
impl<'tree> Send for IncorrectKind<'tree>
impl<'tree> Sync for IncorrectKind<'tree>
impl<'tree> Unpin for IncorrectKind<'tree>
impl<'tree> UnwindSafe for IncorrectKind<'tree>
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