Skip to content

Commit

Permalink
Improve: impl Clone for Raft does not require Clone for its type para…
Browse files Browse the repository at this point in the history
…meters

Thanks to [xDarksome](https://github.com/xDarksome)

- Fix: #870
  • Loading branch information
drmingdrmer committed Jun 16, 2023
1 parent 3f063c6 commit 8dae9ac
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion openraft/src/raft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ where
/// `shutdown` method should be called on this type to await the shutdown of the node. If the parent
/// application needs to shutdown the Raft node for any reason, calling `shutdown` will do the
/// trick.
#[derive(Clone)]
pub struct Raft<C, N, LS, SM>
where
C: RaftTypeConfig,
Expand All @@ -202,6 +201,21 @@ where
_phantom: PhantomData<SM>,
}

impl<C, N, LS, SM> Clone for Raft<C, N, LS, SM>
where
C: RaftTypeConfig,
N: RaftNetworkFactory<C>,
LS: RaftLogStorage<C>,
SM: RaftStateMachine<C>,
{
fn clone(&self) -> Self {
Self {
inner: self.inner.clone(),
_phantom: PhantomData,
}
}
}

impl<C, N, LS, SM> Raft<C, N, LS, SM>
where
C: RaftTypeConfig,
Expand Down

0 comments on commit 8dae9ac

Please sign in to comment.