#[non_exhaustive]pub struct Warning {
pub message: String,
pub origin: Option<Origin>,
pub kind: WarningKind,
}Expand description
Something a user should know about, which is not bad enough to stop for.
Returned rather than printed. mise queues these until its logging is up, and a library that writes to stderr on its own cannot be used by anything that has an opinion about output.
Built through Warning::new or Warning::at rather than as a literal: this has gained a
field once already, and a warning is something a layer reports rather than a shape anything
downstream should be pattern-matched against exhaustively. Reading the fields, and matching with
.., are unaffected.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.message: String§origin: Option<Origin>Where the value that caused it came from, when there was one.
kind: WarningKindWhat sort of thing happened, for a caller that wants to treat them differently.
Implementations§
Source§impl Warning
impl Warning
Sourcepub fn new(message: impl Into<String>) -> Self
pub fn new(message: impl Into<String>) -> Self
A warning of no particular kind, which is what a custom layer’s own complaints are.
Sourcepub fn at(message: impl Into<String>, origin: Origin) -> Self
pub fn at(message: impl Into<String>, origin: Origin) -> Self
The same, about a value that came from somewhere nameable.
Sourcepub fn of(self, kind: WarningKind) -> Self
pub fn of(self, kind: WarningKind) -> Self
This warning, classified.
Chained rather than an argument so the two constructors keep reading as they did, and so a layer that has nothing useful to say about the kind is not made to invent one.