pub struct GotExpected<T> {
pub got: T,
pub expected: T,
}Expand description
A mismatch between an expected value and the actual value found.
Inspired by reth’s GotExpected<T> pattern — useful for version conflicts,
quantity mismatches, and other “expected X but got Y” scenarios.
§Example
use stateset_core::errors::GotExpected;
let mismatch = GotExpected { got: 3, expected: 5 };
assert_eq!(mismatch.to_string(), "expected 5, got 3");Fields§
§got: TThe value that was actually found.
expected: TThe value that was expected.
Implementations§
Source§impl<T> GotExpected<T>
impl<T> GotExpected<T>
Trait Implementations§
Source§impl<T: Clone> Clone for GotExpected<T>
impl<T: Clone> Clone for GotExpected<T>
Source§fn clone(&self) -> GotExpected<T>
fn clone(&self) -> GotExpected<T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<T: Copy> Copy for GotExpected<T>
Source§impl<T: Debug> Debug for GotExpected<T>
impl<T: Debug> Debug for GotExpected<T>
Source§impl<T: Display> Display for GotExpected<T>
impl<T: Display> Display for GotExpected<T>
impl<T: Eq> Eq for GotExpected<T>
Source§impl<T: Debug + Display> Error for GotExpected<T>
impl<T: Debug + Display> Error for GotExpected<T>
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl<T: Hash> Hash for GotExpected<T>
impl<T: Hash> Hash for GotExpected<T>
Source§impl<T: PartialEq> PartialEq for GotExpected<T>
impl<T: PartialEq> PartialEq for GotExpected<T>
impl<T: PartialEq> StructuralPartialEq for GotExpected<T>
Auto Trait Implementations§
impl<T> Freeze for GotExpected<T>where
T: Freeze,
impl<T> RefUnwindSafe for GotExpected<T>where
T: RefUnwindSafe,
impl<T> Send for GotExpected<T>where
T: Send,
impl<T> Sync for GotExpected<T>where
T: Sync,
impl<T> Unpin for GotExpected<T>where
T: Unpin,
impl<T> UnsafeUnpin for GotExpected<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for GotExpected<T>where
T: UnwindSafe,
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