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