[][src]Type Definition molt::types::MoltResult

type MoltResult = Result<Value, ResultCode>;

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

This is the return value of all Molt commands, and the most common return value throughout the Molt code base. Every Molt command returns a Value on success; if the command has no explicit return value, it returns the empty Value, a Value whose string representation is the empty string.

A Molt command returns a ResultCode whenever the calling Molt script should return early: on error, when returning an explicit result via the return command, or when breaking out of a loop via the break or continue commands.

Many of the functions in Molt's Rust API also return MoltResult, for easy use within Molt command definitions.