Expand description
Rust source generation for layline.
Without features, the crate is no_std and provides the model types and validate().
| Feature | Enables | Default |
|---|---|---|
walk | Root and Error. Adds proc-macro2, quote and syn. | No |
emit | emit, which writes source files. Implies walk. | Yes |
The stable API is the model types, validate(), Error, Root and emit.
Model structs are #[non_exhaustive]. Build them with new and the with_* methods.
Modules§
Structs§
- Arm
- One arm of a switch.
- By
- A number taken from an earlier field:
field * scale + offset. - Choice
Def - The arms of a
Segment::Switch. - Coverage
- The bytes a checksum covers, as
over = from..to. - Covered
- A resolved
Coverage, in the caller’s units. - Derive
- A derive written on a generated struct or enum.
- Dispatch
Arm - One arm of a
DispatchDef. - Dispatch
Def - Bodies selected by an id the enclosing message has already read, as
#[derive(Dispatch)]declares. - EnumDef
- An enumeration of named values, with an optional fallback variant for unlisted values.
- Field
- A named field.
- Layout
Def - A fixed-size layout whose fields cover every bit of its container.
- Message
Def - A variable-length message.
- Param
- A read-only integer the enclosing message passes in.
- Range
- The values a
#[range]allows. - Root
- The path to the layline runtime, and the prelude
Spelling. - Stated
- An
#[at]position, checked against the position computed from field widths. - Variant
- One variant of an
EnumDef.
Enums§
- Absence
- What makes an optional
Placedrecord absent. - BitOrder
- Bit order within a bit-addressed container.
- Collection
- The Rust type of a collection. The wire format is the same.
- Container
- How a layout addresses its fields.
- Count
- How many elements a collection has.
- Cover
From - Where a checksum’s range starts.
- CoverTo
- Where a checksum’s range ends.
- Discriminant
- What a switch selects on.
- Endian
- Byte order. Little-endian by default.
- Error
- Why a model could not be turned into code.
- Invalid
- Why an item failed validation.
- Item
- One item of a model.
- Kind
- A field’s type and width.
- Len
- A byte length.
- Presence
- When an optional field is present.
- Scalar
- A scalar field type.
- Segment
- One part of a message.
- Spelling
- How generated code spells prelude names.
- Stated
Unit - The unit of a
StatedDef. - Unit
- A size unit, and its attribute keyword.
Functions§
- validate
- Checks a model item.