pub enum ValidationError {
MissingTarget {
message: &'static str,
expected: &'static str,
},
AmbiguousTarget {
message: &'static str,
expected: &'static str,
},
InvalidRect {
field: &'static str,
},
NonFiniteCoordinate {
field: &'static str,
},
Empty {
field: &'static str,
},
PathTooShort {
got: usize,
},
UnknownPosition {
got: String,
},
PositionOutOfRange {
got: String,
},
ZeroLengthArrow,
BowOutOfRange {
got: String,
},
ZeroTtl,
}Expand description
A message that parsed but cannot be acted on.
Variants§
MissingTarget
Neither form of a two-form message was supplied.
Fields
AmbiguousTarget
Both forms were supplied and they cannot be reconciled.
Fields
InvalidRect
A rect was non-finite or had a non-positive extent.
NonFiniteCoordinate
A coordinate was NaN or infinite.
Empty
A field that must carry content was empty or whitespace.
PathTooShort
A freehand path had too few points to draw.
UnknownPosition
A named position was not one this daemon knows.
PositionOutOfRange
A percentage fell outside the display.
Carries the text rather than the parsed number so that ValidationError stays
Eq, which every other variant already is and which the wire tests rely on.
ZeroLengthArrow
An arrow’s two ends were the same place.
An arrow exists to give a direction, and two coincident ends have none. Drawing something plausible instead would hide what is almost always a client bug.
BowOutOfRange
An arrow’s bow fell outside what still reads as an arrow.
Carries the text rather than the parsed number so that ValidationError stays
Eq, the same trade ValidationError::PositionOutOfRange makes.
ZeroTtl
A time to live was zero.
Its own error rather than a silent clamp, because a zero here is a unit mistake often enough that drawing a mark and removing it in the same breath is more likely to be a bug than an intent.
Implementations§
Trait Implementations§
Source§impl Clone for ValidationError
impl Clone for ValidationError
Source§impl Debug for ValidationError
impl Debug for ValidationError
Source§impl Display for ValidationError
impl Display for ValidationError
impl Eq for ValidationError
Source§impl Error for ValidationError
impl Error for ValidationError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()