Struct rant::Rant

source · []
pub struct Rant { /* private fields */ }
Expand description

A Rant execution context.

Implementations

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

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

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

Creates a new Rant context with the specified options.

Replaces the module resolver.

Compiles a source string using the specified reporter.

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

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.

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.

Compiles a source file using the specified reporter.

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.

Sets a global variable. This will auto-define the global if it doesn’t exist.

If the global already exists and is a constant, the write will not succeed.

Returns true if the write succeeded; otherwise, false.

Sets a global constant. This will auto-define the global if it doesn’t exist.

If the global already exists and is a constant, the write will not succeed.

Returns true if the write succeeded; otherwise, false.

Sets a global’s value, forcing the write even if the existing global is a constant. This will auto-define the global if it doesn’t exist.

Gets the value of a global variable.

Returns true if a global with the specified key exists.

Removes the global with the specified key. Returns true if the global existed prior to removal.

Iterates over the names of all globals stored in the context.

Gets the options used to initialize the context.

Gets the current RNG seed.

Re-seeds the RNG with the specified seed.

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

Registers a data source to the context, making it available to scripts.

Removes the data source with the specified name from the context, making it no longer available to scripts.

Returns a bool indicating whether a data source with the specified name is present in the context.

Removes all data sources from the context.

Returns a reference to the data source associated with the specified name.

Iterates over all data sources (and their names) in the context.

Runs a program and returns the output value.

Runs a program with the specified arguments and returns the output value.

Trait Implementations

Formats the value using the given formatter. Read more

Creates a default Rant instance.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.