From 3e4933090386a4d7e171c2450edf4937baed2628 Mon Sep 17 00:00:00 2001 From: Handy-caT <37216852+Handy-caT@users.noreply.github.com> Date: Thu, 15 Jan 2026 15:17:35 +0300 Subject: [PATCH 1/2] bump + fix --- Cargo.toml | 2 +- src/util/sized.rs | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index d0e7949..09b4b99 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ members = ["codegen", "tools/create-data-file", "tools/dump-data-file"] [package] name = "data_bucket" -version = "0.3.9" +version = "0.3.10" edition = "2021" authors = ["Handy-caT"] license = "MIT" diff --git a/src/util/sized.rs b/src/util/sized.rs index 61ad529..5278af0 100644 --- a/src/util/sized.rs +++ b/src/util/sized.rs @@ -176,6 +176,10 @@ impl SizeMeasurable for Option where T: SizeMeasurable, { + fn align() -> Option { + T::align() + } + fn aligned_size(&self) -> usize { size_of::>() } @@ -295,11 +299,24 @@ mod test { to_bytes::(&t).unwrap().len() ); let t = (u8::MAX, Link::default()); + assert_eq!( + t.aligned_size(), + to_bytes::(&t).unwrap().len() + ); + let t = (Some(0.0f64), Link::default()); assert_eq!( t.aligned_size(), to_bytes::(&t).unwrap().len() ) } + #[test] + fn test_option() { + let t = Some(0.0f64); + assert_eq!( + t.aligned_size(), + to_bytes::(&t).unwrap().len() + ); + } #[test] fn test_string() { From 52074860d74a0b4215034c0f826ed499c0fc5c09 Mon Sep 17 00:00:00 2001 From: Handy-caT <37216852+Handy-caT@users.noreply.github.com> Date: Thu, 5 Feb 2026 15:23:22 +0300 Subject: [PATCH 2/2] corrections to support vacuum in wt --- Cargo.toml | 2 +- src/link.rs | 9 +++++++++ src/page/index/mod.rs | 14 ++++++++------ src/util/sized.rs | 10 ++++++---- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 09b4b99..6aa25f5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ members = ["codegen", "tools/create-data-file", "tools/dump-data-file"] [package] name = "data_bucket" -version = "0.3.10" +version = "0.3.11" edition = "2021" authors = ["Handy-caT"] license = "MIT" diff --git a/src/link.rs b/src/link.rs index 18ceec8..d1bc4b2 100644 --- a/src/link.rs +++ b/src/link.rs @@ -25,6 +25,15 @@ pub struct Link { pub length: u32, } +impl PartialEq for Link +where + T: AsRef, +{ + fn eq(&self, other: &T) -> bool { + other.as_ref().eq(self) + } +} + #[cfg(test)] mod tests { use crate::link::Link; diff --git a/src/page/index/mod.rs b/src/page/index/mod.rs index c8e845f..60a9b7b 100644 --- a/src/page/index/mod.rs +++ b/src/page/index/mod.rs @@ -92,26 +92,28 @@ where } } -impl From> for IndexValue +impl From> for IndexValue where T: Ord, + L: Into, { - fn from(pair: Pair) -> Self { + fn from(pair: Pair) -> Self { IndexValue { key: pair.key, - link: pair.value, + link: pair.value.into(), } } } -impl From> for IndexValue +impl From> for IndexValue where T: Ord, + L: Into, { - fn from(pair: MultiPair) -> Self { + fn from(pair: MultiPair) -> Self { IndexValue { key: pair.key, - link: pair.value, + link: pair.value.into(), } } } diff --git a/src/util/sized.rs b/src/util/sized.rs index 5278af0..2d2834f 100644 --- a/src/util/sized.rs +++ b/src/util/sized.rs @@ -221,20 +221,22 @@ impl VariableSizeMeasurable for String { } } -impl VariableSizeMeasurable for indexset::core::pair::Pair +impl VariableSizeMeasurable for indexset::core::pair::Pair where K: VariableSizeMeasurable, + L: SizeMeasurable + Default, { fn aligned_size(length: usize) -> usize { - align(Link::default().aligned_size() + K::aligned_size(length)) + align(L::default().aligned_size() + K::aligned_size(length)) } } -impl VariableSizeMeasurable for indexset::core::multipair::MultiPair +impl VariableSizeMeasurable for indexset::core::multipair::MultiPair where K: VariableSizeMeasurable, + L: SizeMeasurable + Default, { fn aligned_size(length: usize) -> usize { - align(Link::default().aligned_size() + K::aligned_size(length)) + align(L::default().aligned_size() + K::aligned_size(length)) } }