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 to group them by json::ElemId using Warning::group_by_elem and then
display or report the warnings by path.
The linter report also wants to highlight the source JSON that a warning refers too.
Fields§
§id: ElemIdThe Id of the element that caused the Warning.
This is used for sorting warnings and can be used to retrieve the json::Element object.
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.