pub struct Rejected {
pub code: String,
pub message: String,
pub key: Option<String>,
pub requirement: Option<Box<Requirement>>,
}Expand description
A business reason to refuse a command or query: return it from a handler. code (default
rejected) is what callers act on, message what they show.
A command handler returns Err(Rejected::new("Cart is checked out")); a listener’s query
or middleware handler returns it as a BoxError (.into() or ?). Callers see it as
crate::Outcome::Rejected from submit and as Error::Rejected from query.
Fields§
§code: String§message: String§key: Option<String>Set by the kernel for unique_taken: the name of the key another aggregate holds.
requirement: Option<Box<Requirement>>Set by the kernel for requirement_missing: the first requirement that does not hold.
Boxed: it keeps every Result with an Error small.
Implementations§
Trait Implementations§
impl Eq for Rejected
Source§impl Error for Rejected
impl Error for Rejected
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()
impl StructuralPartialEq for Rejected
Auto Trait Implementations§
impl Forget for Rejected
impl Freeze for Rejectedwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const Requirement is !null: Freeze,
PhantomData<Requirement>: Freeze,
impl Move for Rejected
impl RefUnwindSafe for Rejected
impl Send for Rejected
impl Sync for Rejected
impl Unpin for Rejected
impl UnsafeUnpin for Rejectedwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const Requirement is !null: UnsafeUnpin,
PhantomData<Requirement>: UnsafeUnpin,
impl UnwindSafe for Rejected
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request