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

source

pub fn from_rule_vec(rules: Vec<RuleIDOrCustom>, ctx: &Context) -> Self

source

pub fn get_rule_id(&self, n: NodeID) -> RuleID

source

pub fn subtree_size(&self, n: NodeID) -> usize

source

pub fn mutate_replace_from_tree<'a>( &'a self, n: NodeID, other: &'a Tree, other_node: NodeID ) -> TreeMutation<'a>

source

pub fn get_parent(&self, n: NodeID) -> Option<NodeID>

source

pub fn truncate(&mut self)

source

pub fn generate_from_nt(&mut self, start: NTermID, len: usize, ctx: &Context)

source

pub fn generate_from_rule( &mut self, ruleid: RuleID, max_len: usize, ctx: &Context )

source

pub fn calc_recursions(&self, ctx: &Context) -> Option<Vec<RecursionInfo>>

source

pub fn find_recursions_iter(&self, ctx: &Context) -> Vec<(NodeID, NodeID)>

Trait Implementations§

source§

impl Clone for Tree

source§

fn clone(&self) -> Tree

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Tree

source§

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

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

impl<'de> Deserialize<'de> for Tree

source§

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 Serialize for Tree

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl TreeLike for Tree

source§

fn get_rule_id(&self, n: NodeID) -> RuleID

source§

fn size(&self) -> usize

source§

fn to_tree(&self, _ctx: &Context) -> Tree

source§

fn get_rule<'c>(&self, n: NodeID, ctx: &'c Context) -> &'c Rule

source§

fn get_custom_rule_data(&self, n: NodeID) -> &[u8]

source§

fn get_rule_or_custom(&self, n: NodeID) -> &RuleIDOrCustom

source§

fn get_nonterm_id(&self, n: NodeID, ctx: &Context) -> NTermID

source§

fn unparse<W: Write>(&self, id: NodeID, ctx: &Context, w: &mut W)

source§

fn unparse_to<W: Write>(&self, ctx: &Context, w: &mut W)

source§

fn unparse_to_vec(&self, ctx: &Context) -> Vec<u8>

source§

fn unparse_node_to_vec(&self, n: NodeID, ctx: &Context) -> Vec<u8>

source§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

type Error = Infallible

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

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

Performs the conversion.
source§

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

§

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

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

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

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,

source§

impl<T> Ungil for Twhere T: Send,