pub struct Issue {
pub kind: IssueKind,
pub value: String,
pub suggestion: Option<String>,
}Expand description
Why a value failed to validate.
Structured rather than pre-rendered, for the same reason crate::Presentation
carries semantic hints rather than colours: the embedder owns presentation.
A frontend can localize the text, or offer Issue::suggestion as a
one-tap correction instead of prose. Display renders
the English default.
Fields§
§kind: IssueKindWhat went wrong.
value: StringThe offending value, as text.
suggestion: Option<String>A near miss from the vocabulary, when one is close enough to be worth offering.
Implementations§
Source§impl Issue
impl Issue
Sourcepub fn retired(value: impl Into<String>) -> Self
pub fn retired(value: impl Into<String>) -> Self
A value that is in the vocabulary but retired.
Sourcepub fn custom(value: impl Into<String>, message: impl Into<String>) -> Self
pub fn custom(value: impl Into<String>, message: impl Into<String>) -> Self
An embedder-defined issue with its own message.
Sourcepub fn with_suggestion(self, suggestion: impl Into<String>) -> Self
pub fn with_suggestion(self, suggestion: impl Into<String>) -> Self
Attach a near-miss suggestion.
Trait Implementations§
impl Eq for Issue
impl StructuralPartialEq for Issue
Auto Trait Implementations§
impl Freeze for Issue
impl RefUnwindSafe for Issue
impl Send for Issue
impl Sync for Issue
impl Unpin for Issue
impl UnsafeUnpin for Issue
impl UnwindSafe for Issue
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
Mutably borrows from an owned value. Read more