redb_extras/key_buckets/
mod.rs1use std::fmt;
12
13#[derive(Debug)]
15pub enum BucketError {
16 InvalidBucketSize(u64),
18
19 InvalidRange { start: u64, end: u64 },
21
22 SerializationError(String),
24
25 IterationError(String),
27}
28
29impl fmt::Display for BucketError {
30 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
31 match self {
32 BucketError::InvalidBucketSize(size) => {
33 write!(f, "Invalid bucket size {}: must be greater than 0", size)
34 }
35 BucketError::InvalidRange { start, end } => {
36 write!(
37 f,
38 "Invalid bucket range: start {} must be <= end {}",
39 start, end
40 )
41 }
42 BucketError::SerializationError(msg) => {
43 write!(f, "Serialization error: {}", msg)
44 }
45 BucketError::IterationError(msg) => {
46 write!(f, "Bucket iteration error: {}", msg)
47 }
48 }
49 }
50}
51
52impl std::error::Error for BucketError {
53 fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
54 None
55 }
56}
57
58pub mod iterator;
59pub mod key;
60
61pub use iterator::{
63 BucketIterExt, BucketMultimapIterExt, BucketRangeIterator, BucketRangeMultimapIterator,
64};
65pub use key::{BucketedKey, KeyBuilder};