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>
impl<NID, E> RaftError<NID, E>
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>>
pub fn forward_to_leader<N>(&self) -> Option<&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>>
pub fn into_forward_to_leader<N>(self) -> Option<ForwardToLeader<NID, N>>
Try to convert self to ForwardToLeader error if APIError is a ForwardToLeader error.
Trait Implementations§
source§impl<'de, NID, E> Deserialize<'de> for RaftError<NID, E>where
NID: NodeId,
E: Deserialize<'de>,
impl<'de, NID, E> Deserialize<'de> for RaftError<NID, E>where
NID: NodeId,
E: Deserialize<'de>,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<NID, E> Error for RaftError<NID, E>
impl<NID, E> Error for RaftError<NID, E>
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> From<StorageError<NID>> for RaftError<NID, E>where
NID: NodeId,
impl<NID, E> From<StorageError<NID>> for RaftError<NID, E>where
NID: NodeId,
source§fn from(se: StorageError<NID>) -> Self
fn from(se: StorageError<NID>) -> Self
Converts to this type from the input type.
source§impl<NID, E: PartialEq> PartialEq for RaftError<NID, E>
impl<NID, E: PartialEq> PartialEq for RaftError<NID, E>
source§impl<NID, N, E> TryAsRef<ForwardToLeader<NID, N>> for RaftError<NID, E>
impl<NID, N, E> TryAsRef<ForwardToLeader<NID, N>> for RaftError<NID, E>
source§fn try_as_ref(&self) -> Option<&ForwardToLeader<NID, N>>
fn try_as_ref(&self) -> Option<&ForwardToLeader<NID, N>>
Try to convert this type into a shared reference of
T
.impl<NID, E: Eq> Eq for RaftError<NID, E>
impl<NID, E> StructuralPartialEq for RaftError<NID, E>where
NID: NodeId,
Auto Trait Implementations§
impl<NID, E> Freeze for RaftError<NID, E>
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>
impl<NID, E> UnwindSafe for RaftError<NID, E>where
E: UnwindSafe,
NID: 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