Skip to content

Commit

Permalink
feat(common): derive Copy for DeltaBTreeMap (#14579)
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Chien <[email protected]>
  • Loading branch information
stdrc authored and Little-Wallace committed Jan 20, 2024
1 parent ee3d875 commit 7095765
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/utils/delta_btree_map/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ ignored = ["workspace-hack"]
normal = ["workspace-hack"]

[dependencies]
educe = "0.5"
enum-as-inner = "0.6"

[lints]
Expand Down
4 changes: 3 additions & 1 deletion src/utils/delta_btree_map/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ use std::cmp::Ordering;
use std::collections::BTreeMap;
use std::ops::Bound;

use educe::Educe;
use enum_as_inner::EnumAsInner;

/// [`DeltaBTreeMap`] wraps two [`BTreeMap`] references respectively as snapshot and delta,
/// providing cursor that can iterate over the updated version of the snapshot.
#[derive(Debug, Clone, Copy)]
#[derive(Debug, Educe)]
#[educe(Clone, Copy)]
pub struct DeltaBTreeMap<'a, K: Ord, V> {
snapshot: &'a BTreeMap<K, V>,
delta: &'a BTreeMap<K, Change<V>>,
Expand Down

0 comments on commit 7095765

Please sign in to comment.