Skip to main content

Crate intuicio_core

Crate intuicio_core 

Source
Expand description

The building blocks every Intuicio scripting solution is made of.

Intuicio is not a scripting language. It is a set of pieces to build one from. This crate holds the pieces that every part of such a build agrees on.

§The pipeline

source (text, node graph, anything)
  |  frontend
  v
script data  ->  backend  ->  Function in a Registry
                                    ^
                                    |  Host calls it in a Context
  • A frontend turns some input into script data. It can be a parser, a node graph editor, or anything else that produces the same data.
  • A backend turns script data into a callable function::Function. A virtual machine is the obvious one, a transpiler to Rust is another.
  • The host is the native side: Rust functions and types registered in a registry::Registry, callable from scripts and calling back into them.

§Why script and native calls look the same

Every function, native or scripted, has the same shape: fn(&mut Context, &Registry). It pops its arguments off the context stack and pushes its results back. Neither side can tell which kind it is calling, so a program can mix frontends and backends freely.

§Where to start

  • registry - where every type and function is declared.
  • context - the stack and registers a call runs on.
  • host - the convenient way to call into all of it.
  • script - the data a frontend produces and a backend consumes.
  • types - runtime descriptions of structs and enums.

Modules§

context
The storage a function call runs on.
function
Callable units, and how to describe and find them.
host
The native side of a scripting solution.
meta
Free-form annotations attached to types, functions and fields.
object
Values of types the host was never compiled against.
registry
The catalogue of everything scripts and host can reach.
script
The data a frontend produces and a backend consumes.
transformer
How native function arguments are represented on the script side.
types
Runtime descriptions of structs and enums.
utils
Helpers for moving Object values on and off a data stack.

Macros§

__internal__offset_of__
Re-export used by the define_native_struct! macro to find field offsets. Calculates the offset of the specified field from the start of the named struct.
__internal__offset_of_enum__
Returns the byte offset of a field inside one variant of a repr(u8) enum.
crate_version
Builds an IntuicioVersion from the CARGO_PKG_VERSION_* variables of the calling crate.
define_function
Builds a whole Function from a signature and a Rust body.
define_native_enum
Builds an Enum describing a repr(u8) Rust enum, filling in discriminants and field offsets.
define_native_struct
Builds a Struct describing a Rust type, filling in field offsets.
define_runtime_enum
Builds an Enum that no Rust type backs, laying its variants out.
define_runtime_struct
Builds a Struct that no Rust type backs, laying its fields out.
function_signature
Builds a FunctionSignature, looking every type up in a registry.
meta
Builds a Meta tree from literal syntax.

Structs§

IntuicioVersion
Semantic version of a crate, used to check that plugins match their host.

Enums§

Filter
A search filter for a field that the target may or may not have.
Visibility
How far a type, function or field can be seen from.

Traits§

IntuicioEnum
A Rust enum that can describe itself to a registry.
IntuicioStruct
A Rust struct that can describe itself to a registry.

Functions§

core_version
Returns the version of this crate, for plugins to check against.