pub struct Element {
pub id: ElemId,
pub span: Span,
pub path: Path,
pub location: Location,
}Expand description
A representation of a JSON element that satisfies the needs of most consumers of a Warning.
This representation avoids the complexity of needing to provide a 'buf lifetime to the JSON element.
This would complicate all warnings types with that lifetime.
A consumer of warnings wants them grouped by the element they were reported against and
then displayed by path. Set is keyed by Element::id, so it groups them on insert
and emits the groups in the order the elements appear in the document.
The linter report also wants to highlight the source JSON that a warning refers to.
Fields§
§id: ElemId§span: SpanThe Span that delimits the JSON element.
path: PathThe elements path.
Most consumers of warnings just want this data.
location: LocationThe location (line, column) of the beginning of this element in the JSON file.