Skip to main content

Crate ranty

Crate ranty 

Source
Expand description

§Ranty

Ranty 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.

The language reference and CLI documentation live in the repository’s docs/ directory.

§The Ranty context

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

§Reading compiler errors

You will notice that the Err variant of the Ranty::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, Ranty 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§

compiler
data
runtime

Macros§

runtime_error

Structs§

DefaultModuleResolver
The default filesystem-based module resolver.
LazyThunk
ModuleResolveError
Represents an error that occurred when attempting to load a Ranty module.
NoModuleResolver
Stub module resolver that completely disables modules.
Ranty
A Ranty execution context.
RantyFunction
A function callable from Ranty.
RantyList
Represents Ranty’s list type, which stores an ordered, mutable collection of values.
RantyListHandle
Reference handle for a Ranty list
RantyMap
Represents Ranty’s map type, which stores a mutable collection of key-value pairs. Map keys are always strings.
RantyMapHandle
Reference handle for a Ranty map
RantyNothing
Ranty’s “nothing” value.
RantyOptions
Provides options for customizing the creation of a Ranty instance.
RantyOrderedCollection
Filter type that represents any indexable (ordered) Ranty collection type.
RantyProgram
A compiled Ranty program.
RantyProgramInfo
Contains metadata used to identify a loaded program.
RantyRange
Represents Ranty’s range type, which characterizes a closed range of integers with an exclusive end bound.
RantySelector
Represents a Ranty selector instance used by the resolver to select block branches.
RantySelectorHandle
Reference handle for a Ranty selector.
RantyString
Represents Ranty’s string type.
RantyTuple
Represents Ranty’s tuple type, which stores an ordered, immutable collection of values.
RantyTupleHandle
Reference handle for a Ranty tuple
RequiredVarArgs
Semantic wrapper around a Vec<T>.
VarArgs
Semantic wrapper around a Vec<T>.

Enums§

DataSourceRegisterError
Represents error states that can occur when registering a data source on a Ranty execution context.
IndexError
Error produced by indexing a RantyValue.
KeyError
Error produced by keying a RantyValue.
LazyState
ModuleLoadError
Represents error states that can occur when loading a module.
ModuleResolveErrorReason
Represents the reason for which a Ranty module failed to load.
RantyNumber
Represents a dynamically-typed Ranty number.
RantyValue
A dynamically-typed Ranty value.
RantyValueType
A lightweight representation of a Ranty value’s type.
RantyVar
Represents a Ranty variable of one of two flavors: by-value or by-reference.
SelectorError
Represents error states of a selector.
SelectorMode
Defines available branch selection modes for selectors.
SliceError
Error produced by slicing a RantyValue.
ValueError
Error produced by a RantyValue 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.
RANTY_COMPAT_FILE_EXTENSION
The legacy file extension still accepted for compatibility.
RANTY_FILE_EXTENSION
The preferred file extension for Ranty source files and modules.
RANTY_LANG_VERSION
The Ranty language version implemented by this library.
RANTY_SUPPORTED_FILE_EXTENSIONS
Supported file extensions in resolution order for extensionless module paths.
TYPENAME_BOOL
TYPENAME_FLOAT
TYPENAME_FUNCTION
TYPENAME_INT
TYPENAME_LIST
TYPENAME_MAP
TYPENAME_NOTHING
TYPENAME_RANGE
TYPENAME_SELECTOR
TYPENAME_STRING
TYPENAME_TUPLE

Traits§

FromRanty
FromRantyArgs
Converts from argument list to tuple of impl TryFromRanty values
IntoRanty
Enables infallible conversion into a RantyValue.
IntoRantyFunction
Trait for converting something to a Ranty function.
ModuleResolver
Represents the features required for a module resolver.
TryFromRanty
Enables fallible conversion from a RantyValue.
TryIntoRanty
Enables fallible conversion into a RantyValue.

Functions§

collect_garbage
Immediately runs cycle collection for the current thread’s Ranty heap.

Type Aliases§

ModuleResolveResult
Result type used by the module loader.
RantyFunctionHandle
Type alias for the GC-managed function handle type.
ValueIndexResult
The result type used by Ranty value index read operations.
ValueIndexSetResult
The result type used by Ranty value index write operations.
ValueKeyResult
The result type used by Ranty value key read operations.
ValueKeySetResult
The result type used by Ranty value key write operations.
ValueResult
The result type used by Ranty value operators and conversion.
ValueSliceResult
The result type used by Ranty value slice read operations.
ValueSliceSetResult
The result type used by Ranty value slice write operations.