Struct grammartec::context::Context

source ·
pub struct Context { /* private fields */ }

Implementations§

source§

impl Context

source

pub fn new() -> Self

source

pub fn initialize(&mut self, max_len: usize)

source

pub fn get_rule(&self, r: RuleID) -> &Rule

source

pub fn get_nt(&self, r: &RuleIDOrCustom) -> NTermID

source

pub fn get_num_children(&self, r: &RuleIDOrCustom) -> usize

source

pub fn add_rule(&mut self, nt: &str, format: &[u8]) -> RuleID

source

pub fn add_script( &mut self, nt: &str, nts: &[String], script: PyObject ) -> RuleID

source

pub fn add_regex(&mut self, nt: &str, regex: &str) -> RuleID

source

pub fn add_term_rule(&mut self, nt: &str, term: &[u8]) -> RuleID

source

pub fn aquire_nt_id(&mut self, nt: &str) -> NTermID

source

pub fn nt_id(&self, nt: &str) -> NTermID

source

pub fn nt_id_to_s(&self, nt: NTermID) -> String

source

pub fn calc_min_len(&mut self)

source

pub fn calc_num_options(&mut self)

source

pub fn check_if_nterm_has_multiple_possiblities(&self, nt: &NTermID) -> bool

source

pub fn get_random_len(&self, len: usize, rhs_of_rule: &Vec<NTermID>) -> usize

source

pub fn get_min_len_for_nt(&self, nt: NTermID) -> usize

source

pub fn get_random_rule_for_nt(&self, nt: NTermID, len: usize) -> RuleID

source

pub fn get_applicable_rules( &self, max_len: usize, nt: NTermID, p_include_short_rules: usize ) -> impl Iterator<Item = &RuleID>

source

pub fn get_random_len_for_ruleid(&self, _rule_id: &RuleID) -> usize

source

pub fn get_random_len_for_nt(&self, _nt: &NTermID) -> usize

source

pub fn get_rules_for_nt(&self, nt: NTermID) -> &Vec<RuleID>

source

pub fn generate_tree_from_nt(&self, nt: NTermID, max_len: usize) -> Tree

source

pub fn generate_tree_from_rule(&self, r: RuleID, len: usize) -> Tree

Trait Implementations§

source§

impl Clone for Context

source§

fn clone(&self) -> Context

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 Default for Context

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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> Ungil for Twhere T: Send,