[][src]Struct rant::Rant

pub struct Rant { /* fields omitted */ }

A Rant execution context.

Implementations

impl Rant[src]

pub fn new() -> Self[src]

Creates a new Rant context with the default seed (0) and loads the standard library.

pub fn with_seed(seed: u64) -> Self[src]

Creates a new Rant context with the specified seed and loads the standard library.

pub fn with_random_seed() -> Self[src]

Creates a new Rant context with a seed generated by a thread-local PRNG and loads the standard library.

pub fn with_options(options: RantOptions) -> Self[src]

Creates a new Rant context with the specified options.

impl Rant[src]

#[must_use = "compiling a program without storing or running it achieves nothing"]pub fn compile<R: Reporter>(
    &self,
    source: &str,
    reporter: &mut R
) -> Result<RantProgram, CompilerErrorKind>
[src]

Compiles a source string using the specified reporter.

#[must_use = "compiling a program without storing or running it achieves nothing"]pub fn compile_named<R: Reporter>(
    &self,
    source: &str,
    reporter: &mut R,
    name: &str
) -> Result<RantProgram, CompilerErrorKind>
[src]

Compiles a source string using the specified reporter and source name.

#[must_use = "compiling a program without storing or running it achieves nothing"]pub fn compile_quiet(
    &self,
    source: &str
) -> Result<RantProgram, CompilerErrorKind>
[src]

Compiles a source string without reporting problems.

Note

This method will not generate any compiler messages, even if it fails.

If you require this information, use the compile() method instead.

#[must_use = "compiling a program without storing or running it achieves nothing"]pub fn compile_quiet_named(
    &self,
    source: &str,
    name: &str
) -> Result<RantProgram, CompilerErrorKind>
[src]

Compiles a source string without reporting problems and assigns it the specified name.

Note

This method will not generate any compiler messages, even if it fails.

If you require this information, use the compile() method instead.

#[must_use = "compiling a program without storing or running it achieves nothing"]pub fn compile_file<P: AsRef<Path>, R: Reporter>(
    &self,
    path: P,
    reporter: &mut R
) -> Result<RantProgram, CompilerErrorKind>
[src]

Compiles a source file using the specified reporter.

#[must_use = "compiling a program without storing or running it achieves nothing"]pub fn compile_file_quiet<P: AsRef<Path>>(
    &self,
    path: P
) -> Result<RantProgram, CompilerErrorKind>
[src]

Compiles a source file without reporting problems.

Note

This method will not generate any compiler messages, even if it fails.

If you require this information, use the compile_file() method instead.

pub fn globals(&self) -> RantMapRef[src]

Gets the global variable map of the Rant context.

pub fn set_global(&mut self, key: &str, value: RantValue)[src]

Sets a global variable.

pub fn get_global(&self, key: &str) -> Option<RantValue>[src]

Gets a global variable.

pub fn seed(&self) -> u64[src]

Gets the current RNG seed.

pub fn set_seed(&mut self, seed: u64)[src]

Re-seeds the RNG with the specified seed.

pub fn reset_seed(&mut self)[src]

Resets the RNG back to its initial state with the current seed.

pub fn run(&mut self, program: &RantProgram) -> Result<RantValue, RuntimeError>[src]

Runs the specified Rant program and returns the generated output value.

pub fn run_into_string(
    &mut self,
    program: &RantProgram
) -> Result<String, RuntimeError>
[src]

Runs the specified Rant program and returns the generated output as a string.

Trait Implementations

impl Debug for Rant[src]

impl Default for Rant[src]

fn default() -> Self[src]

Creates a default Rant instance.

Auto Trait Implementations

impl !RefUnwindSafe for Rant

impl !Send for Rant

impl !Sync for Rant

impl Unpin for Rant

impl !UnwindSafe for Rant

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> From<T> for T[src]

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

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.

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