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§
- Default
Module Resolver - The default filesystem-based module resolver.
- Module
Resolve Error - Represents an error that occurred when attempting to load a Rant module.
- NoModule
Resolver - Stub module resolver that completely disables modules.
- Rant
- A Rant execution context.
- Rant
Function - A function callable from Rant.
- Rant
List - Represents Rant’s
list
type, which stores an ordered, mutable collection of values. - Rant
List Handle - Reference handle for a Rant list
- RantMap
- Represents Rant’s
map
type, which stores a mutable collection of key-value pairs. Map keys are always strings. - Rant
MapHandle - Reference handle for a Rant map
- Rant
Nothing - Rant’s “nothing” value.
- Rant
Options - Provides options for customizing the creation of a
Rant
instance. - Rant
Ordered Collection - Filter type that represents any indexable (ordered) Rant collection type.
- Rant
Program - A compiled Rant program.
- Rant
Program Info - Contains metadata used to identify a loaded program.
- Rant
Range - Represents Rant’s
range
type, which characterizes a closed range of integers with an exclusive end bound. - Rant
Selector - Represents a Rant selector instance used by the resolver to select block branches.
- Rant
Selector Handle - Reference handle for a Rant selector.
- Rant
String - Represents Rant’s
string
type. - Rant
Tuple - Represents Rant’s
tuple
type, which stores an ordered, immutable collection of values. - Rant
Tuple Handle - Reference handle for a Rant tuple
- Required
VarArgs - Semantic wrapper around a
Vec<T>
. - VarArgs
- Semantic wrapper around a
Vec<T>
.
Enums§
- Data
Source Register Error - Represents error states that can occur when registering a data source on a Rant execution context.
- Index
Error - Error produced by indexing a RantValue.
- KeyError
- Error produced by keying a RantValue.
- Module
Load Error - Represents error states that can occur when loading a module.
- Module
Resolve Error Reason - Represents the reason for which a Rant module failed to load.
- Rant
Function Interface - Defines endpoint variants for Rant functions.
- Rant
Number - Represents a dynamically-typed Rant number.
- Rant
Value - A dynamically-typed Rant value.
- Rant
Value Type - A lightweight representation of a Rant value’s type.
- RantVar
- Represents a Rant variable of one of two flavors: by-value or by-reference.
- Selector
Error - Represents error states of a selector.
- Selector
Mode - Defines available branch selection modes for selectors.
- Slice
Error - Error produced by slicing a RantValue.
- Value
Error - Error produced by a RantValue operator or conversion.
Constants§
- BUILD_
VERSION - The build version according to the crate metadata at the time of compiling.
- DEFAULT_
PROGRAM_ NAME - The default name given to programs compiled from raw strings.
- RANT_
FILE_ EXTENSION - The file extension that Rant expects modules to have.
- RANT_
LANG_ VERSION - The Rant language version implemented by this library.
- TYPENAME_
BOOL - TYPENAME_
FLOAT - TYPENAME_
FUNCTION - TYPENAME_
INT - TYPENAME_
LIST - TYPENAME_
MAP - TYPENAME_
NOTHING - TYPENAME_
RANGE - TYPENAME_
SELECTOR - TYPENAME_
STRING - TYPENAME_
TUPLE
Traits§
- From
Rant - From
Rant Args - Converts from argument list to tuple of
impl TryFromRant
values - Into
Rant - Enables infallible conversion into a
RantValue
. - Into
Rant Function - Trait for converting something to a Rant function.
- Module
Resolver - Represents the features required for a module resolver.
- TryFrom
Rant - Enables fallible conversion from a
RantValue
. - TryInto
Rant - Enables fallible conversion into a
RantValue
.
Type Aliases§
- Module
Resolve Result - Result type used by the module loader.
- Rant
Function Handle - Type alias for
Rc<RantFunction>
- Value
Index Result - The result type used by Rant value index read operations.
- Value
Index SetResult - The result type used by Rant value index write operations.
- Value
KeyResult - The result type used by Rant value key read operations.
- Value
KeySet Result - The result type used by Rant value key write operations.
- Value
Result - The result type used by Rant value operators and conversion.
- Value
Slice Result - The result type used by Rant value slice read operations.
- Value
Slice SetResult - The result type used by Rant value slice write operations.