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<C, R, E> DecomposeResult<C, R, RaftError<<C as RaftTypeConfig>::NodeId>> for Result<R, RaftError<<C as RaftTypeConfig>::NodeId, E>>where
C: RaftTypeConfig,
impl<C, R, E> DecomposeResult<C, R, RaftError<<C as RaftTypeConfig>::NodeId>> for Result<R, RaftError<<C as RaftTypeConfig>::NodeId, E>>where
C: RaftTypeConfig,
type InnerError = E
fn decompose( self, ) -> Result<Result<R, E>, RaftError<<C as RaftTypeConfig>::NodeId>>
Source§fn decompose_infallible(self) -> Result<R, OuterError>
fn decompose_infallible(self) -> Result<R, OuterError>
Convert
Result<R, CompositeErr>
to Result<R, E>,
if Self::InnerError is a infallible type.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<RaftError<NID, E>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<RaftError<NID, E>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<NID, E> Eq for RaftError<NID, E>
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)>
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()
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>) -> RaftError<NID, E>
fn from(se: StorageError<NID>) -> RaftError<NID, E>
Converts to this type from the input type.
Source§impl<NID, E> PartialEq for RaftError<NID, E>
impl<NID, E> PartialEq for RaftError<NID, E>
Source§impl<NID, E> Serialize for RaftError<NID, E>
impl<NID, E> Serialize for RaftError<NID, E>
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<NID, E> StructuralPartialEq for RaftError<NID, E>where
NID: NodeId,
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.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> UnsafeUnpin for RaftError<NID, E>where
E: UnsafeUnpin,
NID: UnsafeUnpin,
impl<NID, E> UnwindSafe for RaftError<NID, E>where
E: UnwindSafe,
NID: UnwindSafe,
Blanket Implementations§
impl<T> AppData for Twhere
T: OptionalSend + OptionalSync + 'static + OptionalSerde,
impl<T> AppDataResponse for Twhere
T: OptionalSend + OptionalSync + 'static + OptionalSerde,
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> 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> 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>
Converts
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>
Converts
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