pub struct KeyBuilder { /* private fields */ }Expand description
Builder for creating bucketed keys with consistent configuration.
KeyBuilder holds the bucket configuration and can be reused to create bucketed keys for any base key type and sequence.
Implementations§
Source§impl KeyBuilder
impl KeyBuilder
Sourcepub fn new(bucket_size: u64) -> Result<Self, BucketError>
pub fn new(bucket_size: u64) -> Result<Self, BucketError>
Sourcepub fn bucketed_key<K: Key>(&self, base_key: K, sequence: u64) -> BucketedKey<K>
pub fn bucketed_key<K: Key>(&self, base_key: K, sequence: u64) -> BucketedKey<K>
Create a bucketed key from the given base key and sequence.
The bucket is calculated as sequence / bucket_size using integer division.
§Arguments
base_key- The base key (any type implementing redb::Key)sequence- The sequence value to bucket
§Returns
BucketedKey with bucket as prefix and base_key as secondary component
Sourcepub fn bucket_size(&self) -> u64
pub fn bucket_size(&self) -> u64
Get the configured bucket size.
Trait Implementations§
Source§impl Clone for KeyBuilder
impl Clone for KeyBuilder
Source§fn clone(&self) -> KeyBuilder
fn clone(&self) -> KeyBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for KeyBuilder
impl RefUnwindSafe for KeyBuilder
impl Send for KeyBuilder
impl Sync for KeyBuilder
impl Unpin for KeyBuilder
impl UnwindSafe for KeyBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more