[][src]Module molt::types

Public Type Declarations

This module defines a number of types used throughout Molt's public API.

The most important types are Value, the type of data values in the Molt language, and MoltResult, Molt's standard Result<T,E> type. MoltResult is an alias for Result<Value,Exception>, where Exception contains the data relating to an exceptional return from a script. The heart of Exception is the ResultCode, which represents all of the ways a Molt script might return early: errors, explicit returns, breaks, and continues.

MoltInt, MoltFloat, MoltList, and MoltDict a/Displayre simple type aliases defining Molt's internal representation for integers, floats, and TCL lists and dictionaries.

Re-exports

pub use crate::value::Value;

Structs

ContextID

A unique identifier, used to identify cached context data within a given interpreter. For more information see the discussion of command definition and the context cache in The Molt Book and the interp module.

ErrorData

This struct contains the error code and stack trace (i.e., the "error info" string) for ResultCode::Error exceptions.

Exception

This struct represents the exceptional results of evaluating a Molt script, as used in MoltResult. It is often used as the Err type for other functions in the Molt API, so that these functions can easily return errors when used in the definition of Molt commands.

Subcommand

A Molt command that has subcommands is called an ensemble command. In Rust code, the ensemble is defined as an array of Subcommand structs, each one mapping from a subcommand name to the implementing CommandFunc. For more information, see the discussion of command definition in The Molt Book and the interp module.

VarName

In TCL, variable references have two forms. A string like "some_var(some_index)" is the name of an array element; any other string is the name of a scalar variable. This struct is used when parsing variable references. The name is the variable name proper; the index is either None for scalar variables or Some(String) for array elements.

Enums

ResultCode

This enum represents the different kinds of Exception that result from evaluating a Molt script.

Type Definitions

CommandFunc

A function used to implement a binary Molt command. For more information see the discussion of command definition in The Molt Book and the interp module.

MoltDict

The standard dictionary type for Molt code.

MoltFloat

The standard floating point type for Molt code.

MoltInt

The standard integer type for Molt code.

MoltList

The standard list type for Molt code.

MoltResult

The standard Result<T,E> type for Molt code.