Struct mo::config::GeneratorConfig[][src]

pub struct GeneratorConfig {
    pub expand_limit: Option<u32>,
    pub soft_limit: usize,
    pub hard_limit: usize,
    pub limit_depth_level: usize,
    pub text_expand_limit: String,
    pub benchmark_mode: bool,
    pub upper_bound_zero_or_more_repetition: u32,
    pub upper_bound_one_or_more_repetition: u32,
    pub upper_bound_at_least_repetition: u32,
    pub max_attempts_negation: u32,
    // some fields omitted
}

Struct for define the config of the generator

Fields

expand_limit: Option<u32>

Max rules opened in generation, when this limit is reached the generation of subsequent rules return the parameter text_expand_limit.

default value: None (No limit)

soft_limit: usize

To process a rule the elements are placed in a stack. If the grammar is very deep or recursive the number of elements in the stack will be large, if the length of the stack exceeds the value of this parameter then the delimiters “*”, “+” will be converted into ranges [0,1] and [1,2] respectively in order to reduce the number of items to process.

default value: 10.000

hard_limit: usize

In the process of generating an example, each processed expression increases the expression counter, if the parameter value is reached, all the unprocessed expressions from now on will not produce any results, the identifiers will only return the parameter text_expand_limit.

default value: 25.000

limit_depth_level: usize

Limite máximo de recursividad, usado para evitar la excepción StackOverflow All of the generation process of an example happens in a stack (There isn’t recursion involved) except for a little expression !b ~ a. If you have a recursive grammar with a lot of negations, the parameter limit_depth_level return the parameter text_expand_limit.

default value: 200

text_expand_limit: String

factor de convergencia alternativo (no usado actualmente) It’s the text returned by rules when the hard_limit or limit_depth_level is reached

benchmark_mode: bool

This parameter is just for avoid print elements or create a vec with them, because we only want to benchmark the generation

upper_bound_zero_or_more_repetition: u32

Limit the elements generated in a (“example”)* case e.g 1, will be a probability of 0.5 of not generating nothing (0/1) e.g 2, will be a probability of 0.33 of not generating nothing (0/1/2) e.g 3, will be a probability of 0.25 of not generating nothing (0/1/2/3)

upper_bound_one_or_more_repetition: u32

Limit the elements generated in a (“example”)+ case e.g 2, will generate maximum 2 “example” strings e.g 3, will generate maximum 3 “example” strings

upper_bound_at_least_repetition: u32

Upper limit present in “at least” expression e{n,} e.g 15, will generate between {n, n+15} “example” strings e.g 20, will generate between {n, n+20} “example” strings

max_attempts_negation: u32

When generator finds an expression !A ~ B It has to generate B and then probe that is not A here you can limit the times that B is generated and compared with A for more details please refer to README

Implementations

impl GeneratorConfig[src]

pub fn new(config_file: &str) -> Result<Self, ConfigError>[src]

Create a config with the provided TOML file

GeneratorConfig::new("config.toml")

If you want to get default config

let default: GeneratorConfig = Default::default();

pub fn benchmark() -> Self[src]

Create a config for benchmark, It’s just change the parameter benchmark_mode

GeneratorConfig::benchmark()

If you want to get default config

let default: GeneratorConfig = Default::default();

Trait Implementations

impl Clone for GeneratorConfig[src]

impl Debug for GeneratorConfig[src]

impl Default for GeneratorConfig[src]

impl<'de> Deserialize<'de> for GeneratorConfig[src]

impl Serialize for GeneratorConfig[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.