Skip to content

Commit

Permalink
Merge pull request #513 from drmingdrmer/0-deref
Browse files Browse the repository at this point in the history
Refactor: let StoreExt deref to inner storage implementation
  • Loading branch information
drmingdrmer committed Aug 15, 2022
2 parents b4970c5 + f13d584 commit c550585
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions openraft/src/store_ext.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::fmt::Debug;
use std::marker::PhantomData;
use std::ops::Deref;
use std::ops::RangeBounds;
use std::sync::atomic::AtomicBool;
use std::sync::atomic::Ordering;
Expand Down Expand Up @@ -45,6 +46,14 @@ impl<C: RaftTypeConfig, T: RaftStorage<C> + Clone> Clone for StoreExt<C, T> {
}
}

impl<C: RaftTypeConfig, T: RaftStorage<C>> Deref for StoreExt<C, T> {
type Target = T;

fn deref(&self) -> &Self::Target {
&self.inner
}
}

impl<C: RaftTypeConfig, T: RaftStorage<C>> StoreExt<C, T> {
/// Create a StoreExt backed by another store.
pub fn new(inner: T) -> Self {
Expand Down

0 comments on commit c550585

Please sign in to comment.