Struct tree_sitter::Language
source · [−]#[repr(transparent)]pub struct Language(_);
Expand description
An opaque object that defines how to parse a particular language. The code for each
Language
is generated by the Tree-sitter CLI.
Implementations
sourceimpl Language
impl Language
sourcepub fn version(&self) -> usize
pub fn version(&self) -> usize
Get the ABI version number that indicates which version of the Tree-sitter CLI
that was used to generate this Language
.
sourcepub fn node_kind_count(&self) -> usize
pub fn node_kind_count(&self) -> usize
Get the number of distinct node types in this language.
sourcepub fn node_kind_for_id(&self, id: u16) -> Option<&'static str>
pub fn node_kind_for_id(&self, id: u16) -> Option<&'static str>
Get the name of the node kind for the given numerical id.
sourcepub fn id_for_node_kind(&self, kind: &str, named: bool) -> u16
pub fn id_for_node_kind(&self, kind: &str, named: bool) -> u16
Get the numeric id for the given node kind.
sourcepub fn node_kind_is_named(&self, id: u16) -> bool
pub fn node_kind_is_named(&self, id: u16) -> bool
Check if the node type for the given numerical id is named (as opposed to an anonymous node type).
pub fn node_kind_is_visible(&self, id: u16) -> bool
sourcepub fn field_count(&self) -> usize
pub fn field_count(&self) -> usize
Get the number of distinct field names in this language.
sourcepub fn field_name_for_id(&self, field_id: u16) -> Option<&'static str>
pub fn field_name_for_id(&self, field_id: u16) -> Option<&'static str>
Get the field names for the given numerical id.
Trait Implementations
impl Copy for Language
impl Eq for Language
impl Send for Language
impl StructuralEq for Language
impl StructuralPartialEq for Language
impl Sync for Language
Auto Trait Implementations
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more