pub enum RefusalKind {
VersionUnsupported,
VersionBlocked,
ServiceUnknown,
RateLimited,
ShuttingDown,
Other(ErrorCode),
}Expand description
Stable, matchable classification of a broker HelloReply::Refused code.
This is the consumer-facing decision surface for the broker’s refusal
codes: the wire carries an ErrorCode i32, but a future broker may add
codes a consumer’s build predates. Matching on RefusalKind keeps consumer
retry logic exhaustive and forward-compatible — any unrecognized code lands
in RefusalKind::Other rather than silently mismatching.
Variants§
VersionUnsupported
The requested version is below the backend’s min_version or otherwise
not offered. Caller should upgrade/downgrade, not blindly retry.
VersionBlocked
The requested version is explicitly blocked (e.g. yanked). Do not retry with the same version.
ServiceUnknown
The service name is unknown to this broker. A configuration error; retrying will not help.
RateLimited
The broker is rate-limiting this peer. Honour retry_after_ms.
ShuttingDown
The broker is shutting down. Retry against a fresh broker.
Other(ErrorCode)
Any other refusal code (peer rejected, internal, fd pressure, spawn failure, unspecified, or a code newer than this build understands).
Implementations§
Source§impl RefusalKind
impl RefusalKind
Sourcepub fn from_code(code: ErrorCode) -> Self
pub fn from_code(code: ErrorCode) -> Self
Map a wire ErrorCode to its RefusalKind.
Trait Implementations§
Source§impl Clone for RefusalKind
impl Clone for RefusalKind
Source§fn clone(&self) -> RefusalKind
fn clone(&self) -> RefusalKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for RefusalKind
Source§impl Debug for RefusalKind
impl Debug for RefusalKind
impl Eq for RefusalKind
Source§impl PartialEq for RefusalKind
impl PartialEq for RefusalKind
Source§fn eq(&self, other: &RefusalKind) -> bool
fn eq(&self, other: &RefusalKind) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for RefusalKind
Auto Trait Implementations§
impl Freeze for RefusalKind
impl RefUnwindSafe for RefusalKind
impl Send for RefusalKind
impl Sync for RefusalKind
impl Unpin for RefusalKind
impl UnsafeUnpin for RefusalKind
impl UnwindSafe for RefusalKind
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more