Expand description
The error type of the operations that validate whole inputs, and the panics of the others.
The Java implementation distinguishes IndexOutOfBoundsException (an index or ID outside its
range) from IllegalArgumentException (any other violated contract) and, for a builder at its
limit, IllegalStateException. Rust keeps the same distinction in two forms:
- Operations that validate whole inputs return a
ResultwhoseGraphErrornames the category in itsErrorKind. Whole inputs are arrays that must form a graph, a mapping or a partition, and graphs that must be acyclic or a forest. - Single arguments out of their range panic, like an out-of-bounds slice index. So does a
mapping that breaks its contract where it is used, in
NodeMapping::inverted,composeandgraphs::remapped: one that maps two indices to the same index, or that maps outside the space the call names.NodeMapping::ofleaves the first of these to the caller, as Java does. The panic message starts with the category:index out of bounds:,invalid argument:orillegal state:.
Structs§
- Graph
Error - An input that does not meet the contract of the operation it was passed to: the error of the
operations that check a whole input, such as
Graph::ofortop_order::of.
Enums§
- Error
Kind - The category of a
GraphError: the counterpart of the Java exception class.