pub struct ShapeMismatch {
pub expected: Shape,
pub received: Shape,
pub causes: Vec<ShapeMismatch>,
}Expand description
The Shape::validate* methods return a vector of ShapeMismatch errors
that is non-empty when validation fails.
Each ShapeMismatch error contains the expected shape and the received
shape, whose metadata (e.g. shape.locations) provide context for the
mismatch.
Conveniently, the expected/received terminology works for both the
expected.accepts(received) and received.satisfies(expected) directions
of comparison, so ShapeMismatch does not encode whether the accepts or
satisfies was used internally (though validate is similar to accepts
in its order of arguments).
Once issue #5 is implemented, you’ll be able to obtain source location
information from the expected and received shapes (instead of adding
additional fields to the ShapeMismatch struct).
Fields§
§expected: Shape§received: Shape§causes: Vec<ShapeMismatch>Trait Implementations§
Source§impl Clone for ShapeMismatch
impl Clone for ShapeMismatch
Source§impl Debug for ShapeMismatch
impl Debug for ShapeMismatch
impl Eq for ShapeMismatch
Source§impl Hash for ShapeMismatch
impl Hash for ShapeMismatch
Source§impl PartialEq for ShapeMismatch
impl PartialEq for ShapeMismatch
impl StructuralPartialEq for ShapeMismatch
Auto Trait Implementations§
impl Freeze for ShapeMismatch
impl RefUnwindSafe for ShapeMismatch
impl Send for ShapeMismatch
impl Sync for ShapeMismatch
impl Unpin for ShapeMismatch
impl UnsafeUnpin for ShapeMismatch
impl UnwindSafe for ShapeMismatch
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.