pub struct Field {
pub label: GffLabel,
pub shape: Shape,
pub life: Life,
pub absent: Absent,
pub required: bool,
pub constraint: Option<Constraint>,
pub omission: Option<Omission>,
pub modelled: bool,
}Expand description
One field of one GFF struct, and everything established about it.
Fields§
§label: GffLabelThe label as it appears in the file.
A built GffLabel rather than a &str, so a declaration naming
something a GFF cannot hold fails the build at that declaration. Three
of the corpus’s names run past sixteen bytes and the engine truncates
them; a schema that did not would name a label no file can carry, and
any rule keyed on it would be silently dead.
shape: ShapeWhat the field holds, and for a container what its elements hold.
life: LifeWhether the engine reads this label at this path.
absent: AbsentWhat happens when the label is missing.
required: boolWhether absence aborts the containing structure rather than defaulting.
constraint: Option<Constraint>Whether the engine clamps or truncates the value it reads.
omission: Option<Omission>Whether the engine’s own writer leaves this label out at some value.
modelled: boolWhether this layer holds a member for the label.
false for a label the schema declares and the view has no slot for,
which is what gff_entry means. Those paths are real engine facts a
reader cannot observe: whatever the engine substitutes for the absent
label has nowhere to arrive, so a consumer asking “does the fallback
matter here” gets a different answer than at a modelled path, and the
difference is not visible from the other seven.
Implementations§
Source§impl Field
impl Field
Sourcepub fn may_omit(&self, value: &GffValue) -> bool
pub fn may_omit(&self, value: &GffValue) -> bool
Whether the writer may leave this label out when it holds value.
The engine’s own writer omits some labels at some values, and matching
it is what lets an authored file round-trip against one it wrote. A
field declaring no omission answers false, so a missing opt-in costs
a redundant label rather than a dropped value.
OmitWhen::Matches always answers false. Its test is the resolved
value of a sibling, which is not reachable from one entry, and the
engine-side rule for it has not been traced; the fail-safe direction is
to write the label.