LangInner

Struct LangInner 

Source
pub struct LangInner<N: NodeTypes> { /* private fields */ }
Expand description

Generic language implementation parameterized by node types.

This struct provides a single implementation of LangImpl that works with any NodeTypes implementation (static or dynamic).

Implementations§

Source§

impl LangInner<&'static StaticNodeTypes>

Source

pub fn new_static( name: &str, ts_lang: Language, node_types: &'static StaticNodeTypes, ) -> Self

Source

pub fn node_types(&self) -> &'static StaticNodeTypes

Trait Implementations§

Source§

impl<N: Debug + NodeTypes> Debug for LangInner<N>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<N: NodeTypes + Send + Sync> LangImpl for LangInner<N>

Source§

fn name(&self) -> &str

Source§

fn parse(&self, source: &str) -> Tree

Parse source code into a tree-sitter tree.
Source§

fn resolve_named_node(&self, kind: &str) -> Option<NodeTypeId>

Source§

fn resolve_anonymous_node(&self, kind: &str) -> Option<NodeTypeId>

Source§

fn resolve_field(&self, name: &str) -> Option<NodeFieldId>

Source§

fn all_named_node_kinds(&self) -> Vec<&'static str>

Source§

fn all_field_names(&self) -> Vec<&'static str>

Source§

fn node_type_name(&self, node_type_id: NodeTypeId) -> Option<&'static str>

Source§

fn field_name(&self, field_id: NodeFieldId) -> Option<&'static str>

Source§

fn fields_for_node_type(&self, node_type_id: NodeTypeId) -> Vec<&'static str>

Source§

fn is_supertype(&self, node_type_id: NodeTypeId) -> bool

Source§

fn subtypes(&self, supertype: NodeTypeId) -> &[u16]

Source§

fn root(&self) -> Option<NodeTypeId>

Source§

fn is_extra(&self, node_type_id: NodeTypeId) -> bool

Source§

fn has_field( &self, node_type_id: NodeTypeId, node_field_id: NodeFieldId, ) -> bool

Source§

fn field_cardinality( &self, node_type_id: NodeTypeId, node_field_id: NodeFieldId, ) -> Option<Cardinality>

Source§

fn valid_field_types( &self, node_type_id: NodeTypeId, node_field_id: NodeFieldId, ) -> &[NodeTypeId]

Source§

fn is_valid_field_type( &self, node_type_id: NodeTypeId, node_field_id: NodeFieldId, child: NodeTypeId, ) -> bool

Source§

fn children_cardinality(&self, node_type_id: NodeTypeId) -> Option<Cardinality>

Source§

fn valid_child_types(&self, node_type_id: NodeTypeId) -> &[NodeTypeId]

Source§

fn is_valid_child_type( &self, node_type_id: NodeTypeId, child: NodeTypeId, ) -> bool

Auto Trait Implementations§

§

impl<N> Freeze for LangInner<N>
where N: Freeze,

§

impl<N> RefUnwindSafe for LangInner<N>
where N: RefUnwindSafe,

§

impl<N> Send for LangInner<N>
where N: Send,

§

impl<N> Sync for LangInner<N>
where N: Sync,

§

impl<N> Unpin for LangInner<N>
where N: Unpin,

§

impl<N> UnwindSafe for LangInner<N>
where N: UnwindSafe,

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.