Crate rant

source · []
Expand description

Rant

Rant is a high-level procedural templating language. It is designed to help you write more dynamic and expressive templates, dialogue, stories, names, test data, and much more.

For language documentation, see the Rant Reference.

The Rant context

All programs are run through a Rant context, represented by the Rant struct. It allows you to execute Rant programs, define and retrieve global variables, manipulate the RNG, and compile Rant code.

Reading compiler errors

You will notice that the Err variant of the Rant::compile* methods is () instead of providing an error list. Instead, errors and warnings are reported via implementors of the Reporter trait, which allows the user to control what happens to messages emitted by the compiler. Currently, Rant has two built-in Reporter implementations: the unit type (), and Vec<CompilerMessage>. You can also make your own custom reporters to suit your specific needs.

Modules

Macros

Structs

The default filesystem-based module resolver.

Represents an error that occurred when attempting to load a Rant module.

Stub module resolver that completely disables modules.

A Rant execution context.

A function callable from Rant.

Represents Rant’s list type, which stores an ordered, mutable collection of values.

Reference handle for a Rant list

Represents Rant’s map type, which stores a mutable collection of key-value pairs. Map keys are always strings.

Reference handle for a Rant map

Rant’s “nothing” value.

Provides options for customizing the creation of a Rant instance.

Filter type that represents any indexable (ordered) Rant collection type.

A compiled Rant program.

Contains metadata used to identify a loaded program.

Represents Rant’s range type, which characterizes a closed range of integers with an exclusive end bound.

Represents a Rant selector instance used by the resolver to select block branches.

Reference handle for a Rant selector.

Represents Rant’s string type.

Represents Rant’s tuple type, which stores an ordered, immutable collection of values.

Reference handle for a Rant tuple

Semantic wrapper around a Vec<T>.

Semantic wrapper around a Vec<T>.

Enums

Represents error states that can occur when registering a data source on a Rant execution context.

Error produced by indexing a RantValue.

Error produced by keying a RantValue.

Represents error states that can occur when loading a module.

Represents the reason for which a Rant module failed to load.

Defines endpoint variants for Rant functions.

Represents a dynamically-typed Rant number.

A dynamically-typed Rant value.

A lightweight representation of a Rant value’s type.

Represents a Rant variable of one of two flavors: by-value or by-reference.

Represents error states of a selector.

Defines available branch selection modes for selectors.

Error produced by slicing a RantValue.

Error produced by a RantValue operator or conversion.

Constants

The build version according to the crate metadata at the time of compiling.

The default name given to programs compiled from raw strings.

The file extension that Rant expects modules to have.

The Rant language version implemented by this library.

Traits

Converts from argument list to tuple of impl TryFromRant values

Enables infallible conversion into a RantValue.

Trait for converting something to a Rant function.

Represents the features required for a module resolver.

Enables fallible conversion from a RantValue.

Enables fallible conversion into a RantValue.

Type Definitions

Result type used by the module loader.

Type alias for Rc<RantFunction>

The result type used by Rant value index read operations.

The result type used by Rant value index write operations.

The result type used by Rant value key read operations.

The result type used by Rant value key write operations.

The result type used by Rant value operators and conversion.

The result type used by Rant value slice read operations.

The result type used by Rant value slice write operations.