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§
- Action
Spec #[action(...)]on a struct: an action that sets fields of the records selected.- Appearance
Spec #[appearance(...)]on a struct.- Enum
Spec - An enum with
#[derive(BusinessEnum)]. - Field
Settings #[field(...)]on a field.- Field
Spec - A field of a business object.
- File
Spec - 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.
- Object
Settings #[object(...)]on a struct.- Object
Spec - A struct with
#[derive(BusinessObject)]. - Option
Spec - An option of a business enum.
- Rule
Spec - A rule of a field or of a struct.
- Spec
Error - Something wrong at a place of a source text.
Enums§
- Appearance
Piece - One setting of
#[appearance(...)], in the order written. - Choice
Spec #[variant(...)]or#[list_filter(...)]on a struct.- Context
Spec - Where an appearance rule applies.
- Data
Access Spec - Where a list’s records are read.
- Kind
Spec - What a field holds when its attribute says so, instead of its type.
- Rule
Kind Spec - What a rule checks.
- Selection
Spec - How many records an action takes.
- Severity
Spec - How much a broken rule stops.
- Tint
Spec - A color of an appearance rule.
- Type
Kind - What a field’s Rust type holds, by the
FieldValueimplementations ofravenrs-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
BusinessObjectand the enums that deriveBusinessEnum. 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.Nonefor types no field can have, such as tuples or references.