[][src]Crate glsp

The GameLisp scripting language.

For a guided tour of the Rust API, see Section 2 of the Reference Manual.

Modules

prelude

The prelude.

Macros

arr

Constructs an array.

backquote

Equivalent to `.

bail

Constructs a GError and returns it.

compile

Pre-compiles GameLisp code and embeds it into the executable as a byte slice.

ensure

Tests a condition, returning an error if the result is false.

epr

Prints to the active Runtime's current epr_writer.

eprn

Prints to the active Runtime's current epr_writer, with a trailing '\n'.

error

Constructs a GError by formatting a string.

eval

A convenient way to evaluate simple GameLisp code.

lib

Defines a library struct.

macro_no_op

Constructs a GError which represents a macro-no-op, and returns it.

pr

Prints to the active Runtime's current pr_writer.

prn

Prints to the active Runtime's current pr_writer, with a trailing '\n'.

quote

Equivalent to '.

rdata

Defines a struct which can be stored on the garbage-collected heap.

rfn

Wrap a function pointer or closure so that it can be passed to glsp::rfn and similar functions.

str

Constructs a string.

syms

Define a struct which contains a collection of symbols.

tab

Constructs a table.

try_arr

A non-panicking version of arr!.

try_backquote

A non-panicking version of backquote!().

try_tab

A non-panicking version of tab!.

Structs

Arr

The arr primitive type.

Class

The class primitive type.

Coro

The coro primitive type.

GError

The error type generated by GameLisp code.

GFn

The fn primitive type.

GIter

The iter primitive type.

IterDeque

An infallible iterator over a deque's contents.

IterDequeTo

A converting iterator over a deque's contents.

IterTab

An infallible iterator over a table's (key, value) pairs.

IterTabKeys

An infallible iterator over a table's keys.

IterTabKeysTo

A converting iterator over a table's keys.

IterTabTo

A converting iterator over a table's (key, value) pairs.

IterTabValues

An infallible iterator over a table's values.

IterTabValuesTo

A converting iterator over a table's values.

LibRef

A reference to a library.

LibRefMut

A mutable reference to a library.

Obj

The obj primitive type.

OrNil

A wrapper type for an RFn argument which allows it to be #n.

RClass

An implementation detail of the RStore trait and the rdata! macro.

RData

The rdata primitive type.

RFn

The rfn primitive type.

RRef

A shared reference to an RData.

RRefMut

A mutable reference to an RData.

RRoot

A strongly-typed reference to an RData.

Root

A smart pointer onto the garbage-collected heap.

Runtime

The GameLisp interpreter.

RuntimeBuilder

Configuration options for constructing a Runtime.

Str

The str primitive type.

Sym

The sym primitive type.

Tab

The tab primitive type.

TabEntries

An adapter struct which can be used to iterate over the contents of a table.

WrappedFn

Data required to construct an RFn.

Enums

Callable

A type-erased callable.

CoroState

The return value for the Coro::state method.

Deque

A type-erased deque.

EnvMode

A lexical-environment capture mode.

Expander

A type-erased expander.

Expansion

The return value for glsp::expand_1.

GIterLen

The return value for GIter::len.

Iterable

A type-erased iterable.

Num

A type-erased num.

Val

Any GameLisp value.

Constants

GC_DEFAULT_RATIO

Equivalent to (gc-value 'default-ratio).

GC_MIN_RATIO

Equivalent to (gc-value 'min-ratio).

Traits

CallableOps

The callable abstract type.

DequeAccess

Indexing the deque abstract type.

DequeAccessRange

Indexing the deque abstract type.

DequeIndex

An integer type which can be used as a deque index.

DequeOps

The deque abstract type.

DequeRange

An integer range type which can be used to slice a deque.

FromElement

A type which can be extracted from a deque.

FromVal

A type which can be converted from a GameLisp value.

GSend

An auto trait for types which can be moved between one Runtime and another.

GStore

An auto trait for types which can be stored on the garbage-collected heap.

IntoElement

A type which can be stored in a deque.

IntoResult

A type which can be returned from an RFn.

IterableOps

The iterable abstract type.

Lib

A type which can be passed to glsp::add_lib.

MakeArg

A type which can act as an RFn parameter.

RStore

A type which can be moved onto the garbage-collected heap as an RData.

Splay

A type which can be passed to the arr! macro as a splayed argument.

ToCallArgs

A type which can be converted into the arguments to a function call.

ToSym

A type which can be converted to a Sym.

ToVal

A type which can be converted to a GameLisp value.

Functions

add_lib

Registers an instance of a library type.

arr

Constructs an empty array.

arr_from_elem

Constructs an array which contains reps repetitions of elem.

arr_from_iter

Constructs an array from the contents of a Rust iterator.

arr_with_capacity

Constructs an empty array with space for at least capacity elements.

bind_global

Equivalent to (bind-global! s).

bind_macro

Equivalent to (bind-macro! s).

bind_rfn

Binds a Rust function to a global variable.

bind_rfn_macro

Binds a Rust function to a global macro.

call

Invokes a callable value: an RFn, GFn or Class.

chain

Equivalent to (chain ..args).

chunks

Equivalent to (chunks len src-arr).

chunks_exact

Equivalent to (chunks-exact len src-arr).

cloned

Equivalent to (cloned base).

coro_finish

Equivalent to (coro-finish! co).

coro_run

Equivalent to (coro-run co arg).

cycle

Equivalent to (cycle base).

deep_cloned

Equivalent to (deep-cloned base).

del_global

Equivalent to (del-global! s).

del_macro

Equivalent to (del-macro! s).

enumerate

Equivalent to (enumerate base).

eval

Equivalent to (eval val env-mode).

eval_multi

Equivalent to (eval-multi vals env-mode).

expand

Equivalent to (expand val env-mode)

expand_1

Equivalent to (expand-1 env-mode val expander)

expand_multi

Equivalent to (expand-multi vals env-mode)

file_location

Equivalent to (file-location).

filter

Equivalent to (filter f base).

flatten

Equivalent to (flatten base).

freeze_global

Equivalent to (freeze-global! s).

gc

Equivalent to (gc).

gc_ghost_bytes

Equivalent to (gc-value 'ghost-bytes).

gc_old_bytes

Equivalent to (gc-value 'old-bytes).

gc_ratio

Equivalent to (gc-value 'ratio).

gc_set_ratio

Equivalent to (= (gc-value 'ratio) ratio).

gc_young_bytes

Equivalent to (gc-value 'young-bytes).

gensym

Equivalent to (gensym).

gensym_with_tag

Equivalent to (gensym tag).

get_macro

Equivalent to (macro s).

global

Equivalent to (global s).

has_global

Equivalent to (has-global? s).

has_macro

Equivalent to (has-macro? s).

is_valid_sym_char

Equivalent to (valid-sym-char? ch).

is_valid_sym_str

Equivalent to (valid-sym-str? st).

lib

Equivalent to Lib::borrow.

lib_mut

Equivalent to Lib::borrow_mut.

lines

Equivalent to (lines st).

load

Equivalent to (load filename).

load_and_compile

Loads a file and serializes its compiled bytecode to a Vec<u8>.

load_compiled

Loads a file which was previously serialized using glsp::load_and_compile.

map

Equivalent to (map f base).

named_rfn

Creates a GameLisp value which represents a Rust function, with a name.

once

Equivalent to (once ..args).

once_with

Equivalent to (once-with f).

parse

Equivalent to (parse text filename).

parse_1

Equivalent to (parse-1 text filename).

parse_all

Equivalent to (parse-all text filename).

rand_bool

Uses GameLisp's random number generator to produce a bool.

rand_f32

Uses GameLisp's random number generator to produce an f32.

rand_i32

Uses GameLisp's random number generator to produce an i32.

rand_reseed

Equivalent to (rand-reseed seed).

rchunks

Equivalent to (rchunks len src-arr).

rchunks_exact

Equivalent to (rchunks-exact len src-arr).

rdata

Moves a Rust value onto the garbage-collected heap.

repeat

Equivalent to (repeat ..args).

repeat_with

Equivalent to (repeat-with f).

require

Equivalent to (require filename).

rev

Equivalent to (rev base).

rfn

Creates a GameLisp value which represents a Rust function.

rn

Equivalent to (rn start end step-by).

rni

Equivalent to (rni start end step-by).

rroot

Moves a Rust value onto the garbage-collected heap, returning a typed pointer.

seed_gensym

Makes future gensyms globally unique.

set_epr_writer

Changes the output writer used by epr, eprn, epr! and eprn!.

set_global

Equivalent to (= (global s) val).

set_macro

Equivalent to (= (macro s) expander).

set_pr_writer

Changes the output writer used by pr, prn, pr! and prn!.

skip

Equivalent to (skip n base).

skip_while

Equivalent to (skip-while f base).

sleep

Equivalent to (sleep secs).

split

Equivalent to (split st split-at).

stack_trace

Equivalent to (stack-trace).

step_by

Equivalent to (step-by n base).

str

Constructs an empty string.

str_from_iter

Constructs a string from the characters in a Rust iterator.

str_from_rust_str

Constructs an empty string with the same contents as a Rust string slice.

str_with_capacity

Constructs an empty string with space for at least capacity characters.

sym

Equivalent to (sym name).

tab

Constructs an empty table.

tab_from_iter

Constructs a table from the key/value pairs in a Rust iterator.

tab_with_capacity

Constructs an empty table with space for at least capacity elements.

take

Equivalent to (take n base).

take_lib

Unregisters a value previously registered using glsp::add_lib, and returns it.

take_while

Equivalent to (take-while f base).

time

Equivalent to (time).

try_call

Calls a function with either verbose or brief error-reporting.

try_lib

Equivalent to Lib::try_borrow.

try_lib_mut

Equivalent to Lib::try_borrow_mut.

windows

Equivalent to (windows len src-arr).

zip

Equivalent to (zip ..args).

Type Definitions

GResult