Skip to content

Commit

Permalink
add typed version for compact_list_if_needed
Browse files Browse the repository at this point in the history
  • Loading branch information
ofek-sha committed Aug 19, 2024
1 parent d5f6738 commit 8ddbd1c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/typed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::{borrow::Borrow, marker::PhantomData, sync::Arc};
use crate::{
insertion::{ReplaceStatus, SetStatus},
store::TYPED_NAMESPACE,
CandyStore,
CandyStore, ListCompactionParams,
};

use crate::encodable::EncodableUuid;
Expand Down Expand Up @@ -440,6 +440,19 @@ where
self.store.owned_discard_list(list_key)
}

/// Same as [CandyStore::compact_list_if_needed], but `list_key` is typed
pub fn compact_if_needed<Q: ?Sized + Encode>(
&self,
list_key: &Q,
params: ListCompactionParams,
) -> Result<bool>
where
L: Borrow<Q>,
{
let list_key = Self::make_list_key(list_key);
self.store.compact_list_if_needed(&list_key, params)
}

/// Same as [CandyStore::push_to_list_head], but `list_key` is typed
pub fn push_head<Q1: ?Sized + Encode, Q2: ?Sized + Encode>(
&self,
Expand Down

0 comments on commit 8ddbd1c

Please sign in to comment.