#[non_exhaustive]pub struct Reject {
pub code: RejectCode,
pub reason: String,
pub details: String,
pub policy: &'static str,
pub scope: RejectScope,
}Expand description
Single rejection record returned by checks.
§Examples
use openpit::pretrade::{Reject, RejectCode, RejectScope};
let reject = Reject::new(
"RateLimitPolicy",
RejectScope::Order,
RejectCode::RateLimitExceeded,
"rate limit exceeded",
"submitted 3 orders in 1s window, max allowed: 2",
);
assert_eq!(reject.code, RejectCode::RateLimitExceeded);
assert_eq!(reject.reason, "rate limit exceeded");
assert_eq!(reject.details, "submitted 3 orders in 1s window, max allowed: 2");
assert_eq!(reject.policy, "RateLimitPolicy");Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.code: RejectCodeStable machine-readable reject code.
reason: StringHuman-readable reject reason.
details: StringCase-specific reject details.
policy: &'static strPolicy name that produced the reject.
scope: RejectScopeReject scope.
Implementations§
Trait Implementations§
Source§impl Error for Reject
impl Error for Reject
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 Eq for Reject
impl StructuralPartialEq for Reject
Auto Trait Implementations§
impl Freeze for Reject
impl RefUnwindSafe for Reject
impl Send for Reject
impl Sync for Reject
impl Unpin for Reject
impl UnsafeUnpin for Reject
impl UnwindSafe for Reject
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