Skip to main content

Crate ravenrs_app_spec

Crate ravenrs_app_spec 

Source
Expand description

What #[derive(BusinessObject)] and #[derive(BusinessEnum)] read from a struct or an enum, as plain data: the derive turns it into code, and ravenrs-app (feature source) turns it into entities while a program runs, so both accept and refuse the same things, with the same words.

let file = ravenrs_app_spec::parse_file(
    r#"
    #[derive(BusinessObject)]
    #[object(caption = "Banks")]
    struct Bank {
        #[field(typed_key, caption = "Code")]
        code: String,
    }
    "#,
)
.map_err(|errors| errors[0].message.clone())?;
assert_eq!(file.objects[0].name.to_string(), "Bank");
assert!(file.objects[0].fields[0].settings.typed_key);

Structs§

ActionSpec
#[action(...)] on a struct: an action that sets fields of the records selected.
AppearanceSpec
#[appearance(...)] on a struct.
EnumSpec
An enum with #[derive(BusinessEnum)].
FieldSettings
#[field(...)] on a field.
FieldSpec
A field of a business object.
FileSpec
The business objects and enums of a source file, in the order written, and the items it leaves for others to read, such as functions.
ObjectSettings
#[object(...)] on a struct.
ObjectSpec
A struct with #[derive(BusinessObject)].
OptionSpec
An option of a business enum.
RuleSpec
A rule of a field or of a struct.
SpecError
Something wrong at a place of a source text.

Enums§

AppearancePiece
One setting of #[appearance(...)], in the order written.
ChoiceSpec
#[variant(...)] or #[list_filter(...)] on a struct.
ContextSpec
Where an appearance rule applies.
DataAccessSpec
Where a list’s records are read.
KindSpec
What a field holds when its attribute says so, instead of its type.
RuleKindSpec
What a rule checks.
SelectionSpec
How many records an action takes.
SeveritySpec
How much a broken rule stops.
TintSpec
A color of an appearance rule.
TypeKind
What a field’s Rust type holds, by the FieldValue implementations of ravenrs-app.

Functions§

check_assignments
Checks field = expression; ...: it parses, sets something, and names only fields of the struct.
check_expression
Checks that an expression parses and names only fields of the struct.
derives
Whether an item derives name, as #[derive(name)] or #[derive(path::name)].
field_settings
#[field(...)] on one field.
parse_enum
Reads an enum with #[derive(BusinessEnum)].
parse_file
Reads a whole Rust file: the structs that derive BusinessObject and the enums that derive BusinessEnum. Every problem found is returned, each with its place.
parse_object
Reads a struct with #[derive(BusinessObject)], checking what the derive checks, in the same order.
split_names
Names separated by commas, trimmed, without empty ones.
type_kind
What a field’s type holds, looking through Option. None for types no field can have, such as tuples or references.