Skip to content

Commit

Permalink
Feature: Implement TryAsRef<ForwardToLeader<..>> for RaftError
Browse files Browse the repository at this point in the history
- Fix: #1088
  • Loading branch information
HaHa421 authored Apr 8, 2024
1 parent fb296e6 commit a47cd4a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions openraft/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,16 @@ where
}
}

impl<C, E> TryAsRef<ForwardToLeader<C>> for RaftError<C, E>
where
C: RaftTypeConfig,
E: Debug + TryAsRef<ForwardToLeader<C>>,
{
fn try_as_ref(&self) -> Option<&ForwardToLeader<C>> {
self.forward_to_leader()
}
}

impl<C, E> From<StorageError<C::NodeId>> for RaftError<C, E>
where C: RaftTypeConfig
{
Expand Down

0 comments on commit a47cd4a

Please sign in to comment.