Skip to main content

ValidationError

Enum ValidationError 

Source
pub enum ValidationError {
Show 22 variants LinkUnknownFromNode { link_id: String, node_index: usize, }, LinkUnknownToNode { link_id: String, node_index: usize, }, UnknownPatternRef { object_id: String, pattern_id: String, }, UnknownCurveRef { object_id: String, curve_id: String, }, WrongCurveKind { object_id: String, curve_id: String, expected: CurveKind, actual: CurveKind, }, MissingRequiredCurve { object_id: String, expected_kind: CurveKind, }, UnknownNodeIdRef { object_id: String, node_id: String, }, UnknownNodeIndexRef { object_id: String, node_index: usize, }, UnknownLinkIndexRef { object_id: String, link_index: usize, }, LinkSelfLoop { link_id: String, }, NoReservoir, NodeNotReachable { node_id: String, }, TankLevelOutOfRange { node_id: String, min_level: f64, initial_level: f64, max_level: f64, }, PumpCurveNotDecreasing { curve_id: String, }, EfficiencyCurveYOutOfRange { curve_id: String, }, TankVolumeCurveYNotIncreasing { curve_id: String, }, GpvHeadlossCurveYDecreasing { curve_id: String, }, CurveXNotIncreasing { curve_id: String, }, PatternEmpty { pattern_id: String, }, RuleActionUnknownLink { rule_priority: f64, link_index: usize, }, CurveTooFewPoints { curve_id: String, count: usize, }, ControlUnknownLink { control_index: usize, link_index: usize, },
}
Expand description

A validation error produced by Network::validate (§2.9).

Each variant identifies the offending object by its string ID and the constraint violated — as required by §8.1.2.

Variants§

§

LinkUnknownFromNode

from_node index of a link names a node that does not exist.

Fields

§link_id: String

String ID of the offending link.

§node_index: usize

The out-of-range node index stored in from_node.

§

LinkUnknownToNode

to_node index of a link names a node that does not exist.

Fields

§link_id: String

String ID of the offending link.

§node_index: usize

The out-of-range node index stored in to_node.

§

UnknownPatternRef

A pattern ID referenced by an object does not exist.

Fields

§object_id: String

String ID of the object that holds the reference.

§pattern_id: String

The unresolvable pattern string ID.

§

UnknownCurveRef

A curve ID referenced by an object does not exist.

Fields

§object_id: String

String ID of the object that holds the reference.

§curve_id: String

The unresolvable curve string ID.

§

WrongCurveKind

A curve exists but has the wrong kind for the reference.

Fields

§object_id: String

String ID of the object that holds the reference.

§curve_id: String

String ID of the referenced curve.

§expected: CurveKind

The curve kind required by the reference.

§actual: CurveKind

The curve kind actually found.

§

MissingRequiredCurve

A required curve reference (e.g. pump head curve) is absent.

Fields

§object_id: String

String ID of the object that requires the curve.

§expected_kind: CurveKind

The curve kind that is missing.

§

UnknownNodeIdRef

A node string ID referenced by an object does not exist.

Fields

§object_id: String

String ID of the object that holds the reference.

§node_id: String

The unresolvable node string ID.

§

UnknownNodeIndexRef

A node index in a control or rule premise is out of range.

Fields

§object_id: String

String ID of the control or rule that holds the reference.

§node_index: usize

The out-of-range node index.

§

UnknownLinkIndexRef

A link index in a rule premise is out of range.

Fields

§object_id: String

String ID of the rule that holds the reference.

§link_index: usize

The out-of-range link index.

§

LinkSelfLoop

A link connects a node to itself.

Fields

§link_id: String

String ID of the self-looping link.

§

NoReservoir

The network has no reservoir (fixed-grade node).

§

NodeNotReachable

A junction or tank not reachable from any reservoir.

Fields

§node_id: String

String ID of the isolated node.

§

TankLevelOutOfRange

A tank’s initial_level is outside [min_level, max_level].

Fields

§node_id: String

String ID of the tank node.

§min_level: f64

Minimum level configured on the tank (m).

§initial_level: f64

Initial level configured on the tank (m).

§max_level: f64

Maximum level configured on the tank (m).

§

PumpCurveNotDecreasing

A PUMP_HEAD curve’s y-values are not strictly decreasing.

Fields

§curve_id: String

String ID of the offending curve.

§

EfficiencyCurveYOutOfRange

A PUMP_EFFICIENCY curve’s y-values are not all in (0, 100].

Fields

§curve_id: String

String ID of the offending curve.

§

TankVolumeCurveYNotIncreasing

A TANK_VOLUME curve’s y-values are not strictly increasing.

Fields

§curve_id: String

String ID of the offending curve.

§

GpvHeadlossCurveYDecreasing

A GPV_HEADLOSS curve’s y-values are not non-decreasing.

Fields

§curve_id: String

String ID of the offending curve.

§

CurveXNotIncreasing

A curve’s x-values are not strictly increasing.

Fields

§curve_id: String

String ID of the offending curve.

§

PatternEmpty

A pattern contains no factors.

Fields

§pattern_id: String

String ID of the empty pattern.

A rule action references a link index that is out of range.

Fields

§rule_priority: f64

Priority of the rule containing the offending action.

§link_index: usize

The out-of-range link index stored in the action.

§

CurveTooFewPoints

A curve has fewer than 2 data points (§2.3 requires length ≥ 2).

Fields

§curve_id: String

String ID of the offending curve.

§count: usize

Number of points actually present.

A simple control references a link index that is out of range.

Fields

§control_index: usize

Zero-based position of the offending control in Network::controls.

§link_index: usize

The out-of-range 1-based link index stored in the control.

Trait Implementations§

Source§

impl Clone for ValidationError

Source§

fn clone(&self) -> ValidationError

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ValidationError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Display for ValidationError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl PartialEq for ValidationError

Source§

fn eq(&self, other: &ValidationError) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for ValidationError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.