pub enum RaftError<NID, E = Infallible>where
NID: NodeId,{
APIError(E),
Fatal(Fatal<NID>),
}
Expand description
RaftError is returned by API methods of Raft
.
It is either a Fatal error indicating that Raft
is no longer running, such as underlying IO
error, or an API error E
.
Variants§
Implementations§
source§impl<NID, E> RaftError<NID, E>where
NID: NodeId,
E: Debug,
impl<NID, E> RaftError<NID, E>where NID: NodeId, E: Debug,
sourcepub fn into_api_error(self) -> Option<E>
pub fn into_api_error(self) -> Option<E>
Try to convert self to APIError.
sourcepub fn into_fatal(self) -> Option<Fatal<NID>>
pub fn into_fatal(self) -> Option<Fatal<NID>>
Try to convert self to Fatal error.
sourcepub fn forward_to_leader<N>(&self) -> Option<&ForwardToLeader<NID, N>>where
N: Node,
E: TryAsRef<ForwardToLeader<NID, N>>,
pub fn forward_to_leader<N>(&self) -> Option<&ForwardToLeader<NID, N>>where N: Node, E: TryAsRef<ForwardToLeader<NID, N>>,
Return a reference to ForwardToLeader if Self::APIError contains it.
sourcepub fn into_forward_to_leader<N>(self) -> Option<ForwardToLeader<NID, N>>where
N: Node,
E: TryInto<ForwardToLeader<NID, N>>,
pub fn into_forward_to_leader<N>(self) -> Option<ForwardToLeader<NID, N>>where N: Node, E: TryInto<ForwardToLeader<NID, N>>,
Try to convert self to ForwardToLeader error if APIError is a ForwardToLeader error.
Trait Implementations§
source§impl<NID, E> Display for RaftError<NID, E>where
NID: NodeId,
E: Display,
Fatal<NID>: Display,
impl<NID, E> Display for RaftError<NID, E>where NID: NodeId, E: Display, Fatal<NID>: Display,
source§impl<NID, E> Error for RaftError<NID, E>where
NID: NodeId,
E: Error,
Fatal<NID>: Error,
Self: Debug + Display,
impl<NID, E> Error for RaftError<NID, E>where NID: NodeId, E: Error, Fatal<NID>: Error, Self: Debug + Display,
source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
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<NID, E: PartialEq> PartialEq<RaftError<NID, E>> for RaftError<NID, E>where
NID: NodeId + PartialEq,
impl<NID, E: PartialEq> PartialEq<RaftError<NID, E>> for RaftError<NID, E>where NID: NodeId + PartialEq,
impl<NID, E: Eq> Eq for RaftError<NID, E>where NID: NodeId + Eq,
impl<NID, E> StructuralEq for RaftError<NID, E>where NID: NodeId,
impl<NID, E> StructuralPartialEq for RaftError<NID, E>where NID: NodeId,
Auto Trait Implementations§
impl<NID, E> RefUnwindSafe for RaftError<NID, E>where E: RefUnwindSafe, NID: RefUnwindSafe,
impl<NID, E> Send for RaftError<NID, E>where E: Send,
impl<NID, E> Sync for RaftError<NID, E>where E: Sync,
impl<NID, E> Unpin for RaftError<NID, E>where E: Unpin, NID: Unpin,
impl<NID, E> UnwindSafe for RaftError<NID, E>where E: UnwindSafe, NID: UnwindSafe,
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.