pub struct Resrap { /* private fields */ }Expand description
Resrap is the main access point for single-threaded uses. It’s a collection of grammars which can be generated using parsing grammar.
Implementations§
Source§impl Resrap
impl Resrap
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates and returns a new Resrap instance. The returned instance starts with no loaded grammars.
Sourcepub fn generate_with_seed(
&self,
name: &str,
starting_node: String,
seed: u64,
tokens: usize,
) -> Result<Vec<String>, &str>
pub fn generate_with_seed( &self, name: &str, starting_node: String, seed: u64, tokens: usize, ) -> Result<Vec<String>, &str>
Generates content from the grammar identified by ‘name’ with a seed.
§Arguments
name- The grammar name to usestarting_node- The starting symbol in the grammar for generationseed- A numeric seed to make generation deterministictokens- Number of tokens to generate
§Returns
A string containing the generated content.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Resrap
impl RefUnwindSafe for Resrap
impl Send for Resrap
impl Sync for Resrap
impl Unpin for Resrap
impl UnwindSafe for Resrap
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