Skip to main content

Crate layline_codegen

Crate layline_codegen 

Source
Expand description

Rust source generation for layline.

Without features, the crate is no_std and provides the model types and validate().

FeatureEnablesDefault
walkRoot and Error. Adds proc-macro2, quote and syn.No
emitemit, 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§

emit
Formatted Rust source generated from the model.

Structs§

Arm
One arm of a switch.
By
A number taken from an earlier field: field * scale + offset.
ChoiceDef
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.
DispatchArm
One arm of a DispatchDef.
DispatchDef
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.
LayoutDef
A fixed-size layout whose fields cover every bit of its container.
MessageDef
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 Placed record 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.
CoverFrom
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.
StatedUnit
The unit of a StatedDef.
Unit
A size unit, and its attribute keyword.

Functions§

validate
Checks a model item.