Common schemas used by the engine. These schemas are somewhat redundant with Semio Records, but it is quite a lot of work to switch to Semio Records.
High-level schemas use names to reference other entities. Names are meant to be resolved using a registry, or local indexes associating UUIDs to names.
Low-level schemas are produced for contexts where UUIDs are sufficient, if not more efficient for looking them up.
The "high-level" ModuleDefinition
is used to describe completely a module to implement.
It is usually saved as a module.yaml
file
(using serde-yaml
).
It can be used by the code generators of
arora-module-cli
to produce the proper bindings for a module.
The "low-level" format of a module is called a
Header
,
and is produced by the code generators under the file name header.yaml
.
It is used to load the module in the engine,
with arora-cli
.
Modules may export symbols, so that they can be called by any client. Modules may also declare symbols to import from other modules, so that the right bindings are made available in the implementation. The only symbols supported so far are functions. Their declaration may involve references to existing types:
- directly (
TypeRef::Scalar
) - as the element type of an array (
TypeRef::Array
) - as the key or value type of a map (
TypeRef::Map
). This kind of reference is not supported in this project, in practice.
Structured types can be described in both high-level or low-level ways, so that they can be used in both high-level or low-level modules. This library can describe:
- primitive types, equivalent in Rust to:
bool
,u8
,u16
,u32
,u64
,i8
,i16
,i32
,i64
,f32
,f64
,String
. - enumerations, similar to Rust
enum
s: each variant can hold a value of any other type, and do not necessarily translate into an integer. - structures, similar to Rust
struct
s and C / C++ PODs: each field has a name and holds a value.
A Value
describes a value defined
in the low-level type schema.
It is generic and can also be serialized
(using serde
.
For other kind of conversions
a common error type is suggested:
arora-schema::value::ConversionError
.
Value
s are useful at runtime
to pass arguments to functions,
but also to describe default_value
s
for function parameters.
Note: we call "parameter" the declaration of what function may accept as inputs (or outputs, if
mutable
). We call "argument" the actual value passed to the function.