pub struct DynamicNodeTypes { /* private fields */ }Expand description
Compiled node type database for a language (dynamic/heap-allocated).
Use this for runtime construction or as reference implementation.
For zero-init static data, use StaticNodeTypes.
Implementations§
Source§impl DynamicNodeTypes
impl DynamicNodeTypes
pub fn from_raw( nodes: HashMap<NodeTypeId, NodeTypeInfo>, extras: Vec<NodeTypeId>, root: Option<NodeTypeId>, ) -> Self
Sourcepub fn build<F, G>(
raw_nodes: &[RawNode],
node_id_for_name: F,
field_id_for_name: G,
) -> Self
pub fn build<F, G>( raw_nodes: &[RawNode], node_id_for_name: F, field_id_for_name: G, ) -> Self
Build from raw nodes and ID resolution functions.
pub fn get(&self, node_type_id: NodeTypeId) -> Option<&NodeTypeInfo>
pub fn contains(&self, node_type_id: NodeTypeId) -> bool
pub fn field( &self, node_type_id: NodeTypeId, field_id: NodeFieldId, ) -> Option<&FieldInfo>
pub fn children(&self, node_type_id: NodeTypeId) -> Option<&ChildrenInfo>
pub fn extras(&self) -> &[NodeTypeId] ⓘ
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn iter(&self) -> impl Iterator<Item = (NodeTypeId, &NodeTypeInfo)>
Sourcepub fn sorted_node_ids(&self) -> Vec<NodeTypeId> ⓘ
pub fn sorted_node_ids(&self) -> Vec<NodeTypeId> ⓘ
Get sorted vec of all node IDs (for conversion to static).
Sourcepub fn sorted_extras(&self) -> Vec<NodeTypeId> ⓘ
pub fn sorted_extras(&self) -> Vec<NodeTypeId> ⓘ
Get sorted vec of extra IDs (for conversion to static).
Trait Implementations§
Source§impl Clone for DynamicNodeTypes
impl Clone for DynamicNodeTypes
Source§fn clone(&self) -> DynamicNodeTypes
fn clone(&self) -> DynamicNodeTypes
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DynamicNodeTypes
impl Debug for DynamicNodeTypes
Source§impl NodeTypes for DynamicNodeTypes
impl NodeTypes for DynamicNodeTypes
fn root(&self) -> Option<NodeTypeId>
fn is_extra(&self, node_type_id: NodeTypeId) -> bool
fn has_field( &self, node_type_id: NodeTypeId, node_field_id: NodeFieldId, ) -> bool
fn field_cardinality( &self, node_type_id: NodeTypeId, node_field_id: NodeFieldId, ) -> Option<Cardinality>
fn valid_field_types( &self, node_type_id: NodeTypeId, node_field_id: NodeFieldId, ) -> &[NodeTypeId] ⓘ
fn is_valid_field_type( &self, node_type_id: NodeTypeId, node_field_id: NodeFieldId, child: NodeTypeId, ) -> bool
fn children_cardinality(&self, node_type_id: NodeTypeId) -> Option<Cardinality>
fn valid_child_types(&self, node_type_id: NodeTypeId) -> &[NodeTypeId] ⓘ
fn is_valid_child_type( &self, node_type_id: NodeTypeId, child: NodeTypeId, ) -> bool
Auto Trait Implementations§
impl Freeze for DynamicNodeTypes
impl RefUnwindSafe for DynamicNodeTypes
impl Send for DynamicNodeTypes
impl Sync for DynamicNodeTypes
impl Unpin for DynamicNodeTypes
impl UnwindSafe for DynamicNodeTypes
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)