Struct grammartec::tree::Tree
source · pub struct Tree {
pub rules: Vec<RuleIDOrCustom>,
pub sizes: Vec<usize>,
pub paren: Vec<NodeID>,
}
Fields§
§rules: Vec<RuleIDOrCustom>
§sizes: Vec<usize>
§paren: Vec<NodeID>
Implementations§
source§impl Tree
impl Tree
pub fn from_rule_vec(rules: Vec<RuleIDOrCustom>, ctx: &Context) -> Self
pub fn get_rule_id(&self, n: NodeID) -> RuleID
pub fn subtree_size(&self, n: NodeID) -> usize
pub fn mutate_replace_from_tree<'a>( &'a self, n: NodeID, other: &'a Tree, other_node: NodeID ) -> TreeMutation<'a>
pub fn get_parent(&self, n: NodeID) -> Option<NodeID>
pub fn truncate(&mut self)
pub fn generate_from_nt(&mut self, start: NTermID, len: usize, ctx: &Context)
pub fn generate_from_rule( &mut self, ruleid: RuleID, max_len: usize, ctx: &Context )
pub fn calc_recursions(&self, ctx: &Context) -> Option<Vec<RecursionInfo>>
pub fn find_recursions_iter(&self, ctx: &Context) -> Vec<(NodeID, NodeID)>
Trait Implementations§
source§impl<'de> Deserialize<'de> for Tree
impl<'de> Deserialize<'de> for Tree
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl TreeLike for Tree
impl TreeLike for Tree
fn get_rule_id(&self, n: NodeID) -> RuleID
fn size(&self) -> usize
fn to_tree(&self, _ctx: &Context) -> Tree
fn get_rule<'c>(&self, n: NodeID, ctx: &'c Context) -> &'c Rule
fn get_custom_rule_data(&self, n: NodeID) -> &[u8] ⓘ
fn get_rule_or_custom(&self, n: NodeID) -> &RuleIDOrCustom
fn get_nonterm_id(&self, n: NodeID, ctx: &Context) -> NTermID
fn unparse<W: Write>(&self, id: NodeID, ctx: &Context, w: &mut W)
fn unparse_to<W: Write>(&self, ctx: &Context, w: &mut W)
fn unparse_to_vec(&self, ctx: &Context) -> Vec<u8> ⓘ
fn unparse_node_to_vec(&self, n: NodeID, ctx: &Context) -> Vec<u8> ⓘ
fn unparse_print(&self, ctx: &Context)
Auto Trait Implementations§
impl RefUnwindSafe for Tree
impl Send for Tree
impl Sync for Tree
impl Unpin for Tree
impl UnwindSafe for 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