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: ElemIdThe Id of the element that caused the Warning.
Set groups and orders warnings by this id.
Pass it to json::Document::element to get the live json::Element back, which is
what acting on a warning takes rather than just reporting it: the value, the child
elements and json::Element::full_span are all absent here.
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.
Trait Implementations§
impl Eq for Element
impl StructuralPartialEq for Element
Auto Trait Implementations§
impl Freeze for Element
impl RefUnwindSafe for Element
impl Send for Element
impl Sync for Element
impl Unpin for Element
impl UnsafeUnpin for Element
impl UnwindSafe for Element
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoCaveat for T
impl<T> IntoCaveat for T
Source§fn into_caveat<W>(self, warnings: Set<W>) -> Caveat<T, W>where
W: Warning,
fn into_caveat<W>(self, warnings: Set<W>) -> Caveat<T, W>where
W: Warning,
Caveat<T> by supplying a list of Warnings.Source§fn into_infallible_caveat(self) -> Caveat<Self, Infallible>
fn into_infallible_caveat(self) -> Caveat<Self, Infallible>
FromSchema is infallible a Caveat can be created using this method.