pub struct Report { /* private fields */ }Expand description
The issues found so far in one validation. Validation adds to it as it goes through a value.
It allocates when it records its first issue, not before, so a valid value never pays for it.
A report started with Report::failing_fast keeps only its first issue. Once it has that issue,
it is finished and records nothing more.
Implementations§
Source§impl Report
impl Report
Sourcepub const fn failing_fast() -> Self
pub const fn failing_fast() -> Self
An empty report that keeps only the first issue found.
Sourcepub const fn new_alike(&self) -> Self
pub const fn new_alike(&self) -> Self
An empty report that gathers as this one does: every issue, or only the first when this report is failing fast.
Use it to keep the issues found in one part of a value apart, until append
moves them into this report.
Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
Whether validation should stop, because the report is failing fast and already has its issue. A report that keeps every issue is never finished.
Sourcepub fn push(&mut self, at: &Location<'_>, problem: Problem)
pub fn push(&mut self, at: &Location<'_>, problem: Problem)
Records problem at the location at, unless the report is finished.
Sourcepub fn push_with_message(
&mut self,
at: &Location<'_>,
problem: Problem,
message: impl Into<Cow<'static, str>>,
)
pub fn push_with_message( &mut self, at: &Location<'_>, problem: Problem, message: impl Into<Cow<'static, str>>, )
Records problem at the location at, with message in place of the problem’s own message, unless the report
is finished.
{name} in the message is replaced by the problem’s parameter name. Write {{ and }} for literal braces.