Skip to content

Commit

Permalink
Explicitly specify various missing trait impls (#26)
Browse files Browse the repository at this point in the history
* map: impl Default for custom arguments

* map::iter: impl DoubleEnded + ExactSize + Fused

* NodeStoreVec: impl Clone for custom arguments
  • Loading branch information
michaelsutton authored Aug 7, 2024
1 parent 78be63a commit 72631e6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub struct BPlusTreeMap<K: Key, V, A: Argument<K> = ()> {
inner: BPlusTree<NodeStoreVec<K, V, A>>,
}

impl<K: Key, V> Default for BPlusTreeMap<K, V> {
impl<K: Key, V, A: Argument<K>> Default for BPlusTreeMap<K, V, A> {
fn default() -> Self {
Self::new()
}
Expand Down Expand Up @@ -149,7 +149,10 @@ impl<K: Key, V, A: Argument<K>> BPlusTreeMap<K, V, A> {
/// assert_eq!(kvs, vec![(1, 2), (2, 3)]);
/// ```
#[inline]
pub fn iter(&self) -> impl Iterator<Item = (&K, &V)> {
pub fn iter(
&self,
) -> impl DoubleEndedIterator<Item = (&K, &V)> + ExactSizeIterator + std::iter::FusedIterator
{
iter::Iter {
inner: self.inner.iter(),
}
Expand Down
2 changes: 1 addition & 1 deletion src/tree/node_stores/vec_backed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub struct NodeStoreVec<K: Key, V, A: Argument<K> = ()> {
cached_leaf: std::sync::atomic::AtomicUsize,
}

impl<K: Key, V: Clone> Clone for NodeStoreVec<K, V> {
impl<K: Key, V: Clone, A: Argument<K>> Clone for NodeStoreVec<K, V, A> {
fn clone(&self) -> Self {
Self {
inner_nodes: self.inner_nodes.clone(),
Expand Down

0 comments on commit 72631e6

Please sign in to comment.