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] 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() {