[−][src]Struct rant::Rant
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_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]
&self,
source: &str,
reporter: &mut R
) -> Result<RantProgram, CompilerErrorKind>
Compiles a source string using the specified reporter.
#[must_use =
"compiling a program without storing or running it achieves nothing"]pub fn compile_quiet(
&self,
source: &str
) -> Result<RantProgram, CompilerErrorKind>
[src]
&self,
source: &str
) -> Result<RantProgram, CompilerErrorKind>
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_file<P: AsRef<Path>, R: Reporter>(
&self,
path: P,
reporter: &mut R
) -> Result<RantProgram, CompilerErrorKind>
[src]
&self,
path: P,
reporter: &mut R
) -> Result<RantProgram, CompilerErrorKind>
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]
&self,
path: P
) -> Result<RantProgram, CompilerErrorKind>
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]
&mut self,
program: &RantProgram
) -> Result<String, RuntimeError>
Runs the specified Rant program and returns the generated output as a string.
Trait Implementations
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,