pub enum Severity {
Notice,
Confirm,
ConfirmExplicitly,
}Expand description
What the host should do about a consequence — the interaction, not a
measure of how bad it is. Mirrors Validation’s
Ok/Warn/Reject: the crate names the response, the embedder renders it.
Exhaustive on purpose, unlike most of this crate’s enums. A host that met an
unhandled severity through a _ arm would quietly under-warn about the
change it was told to warn about hardest, which is the exact failure this
type exists to prevent. Adding a level is worth a major.
Ordering is severity order, ascending — see FieldRule::severity_of.
Variants§
Notice
Say so, but don’t interrupt: an inline note beside the field.
Confirm
Ask before committing — an ordinary confirm/cancel.
ConfirmExplicitly
Ask, and make agreeing deliberate: type the value, hold to confirm, whatever the frontend’s strongest gesture is. For a change that cannot be undone.
Implementations§
Source§impl Severity
impl Severity
Sourcepub fn from_name(name: &str) -> Option<Severity>
pub fn from_name(name: &str) -> Option<Severity>
The severity a schema document’s severity key names — notice,
confirm, confirm_explicitly — or None for any other spelling. The
loader treats that None as an error rather than a default, for the
reason this enum is exhaustive: under-warning about the change the
author warned about hardest is the one failure the type exists to
prevent.
use fig_schema::Severity;
assert_eq!(Severity::from_name("confirm"), Some(Severity::Confirm));
assert_eq!(Severity::from_name("warn"), None);Sourcepub fn name(self) -> &'static str
pub fn name(self) -> &'static str
The name Severity::from_name reads this severity back from.