diff --git a/Cargo.toml b/Cargo.toml index 4c20502..99ba08f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "massmap" -version = "0.1.4" +version = "0.1.5" edition = "2024" authors = ["SF-Zhou "] homepage = "https://github.com/SF-Zhou/massmap" diff --git a/src/massmap.rs b/src/massmap.rs index 48a0f54..6410a0c 100644 --- a/src/massmap.rs +++ b/src/massmap.rs @@ -28,11 +28,11 @@ pub struct MassMapInner, + pub bucket_metas: Vec, /// Hash state initialized with the stored seed. build_hasher: H::BuildHasher, /// Reader used to access the backing storage. - pub(crate) reader: R, + pub reader: R, } /// Typed view over a [`MassMapInner`]. @@ -142,24 +142,24 @@ where } /// Exposes a reference to the underlying immutable metadata. - /// - /// This is primarily intended for internal crate use (e.g. merging maps). - pub(crate) fn meta(&self) -> &MassMapMeta { + pub fn meta(&self) -> &MassMapMeta { &self.inner.meta } /// Exposes a reference to the underlying bucket metadata array. - pub(crate) fn bucket_metas(&self) -> &[MassMapBucketMeta] { + pub fn bucket_metas(&self) -> &[MassMapBucketMeta] { &self.inner.bucket_metas } - /// Exposes the underlying header for internal crate use. - pub(crate) fn header(&self) -> &MassMapHeader { + /// Returns a reference to the underlying massmap header. + /// + /// This can be used to inspect metadata about the massmap file, such as version or configuration. + pub fn header(&self) -> &MassMapHeader { &self.inner.header } - /// Exposes a reference to the underlying reader for internal crate use. - pub(crate) fn reader(&self) -> &R { + /// Returns a reference to the underlying reader used to access the backing storage. + pub fn reader(&self) -> &R { &self.inner.reader } @@ -295,7 +295,8 @@ where }) } - fn bucket_index(&self, k: &Q) -> usize + /// Computes the bucket index for the given key. + pub fn bucket_index(&self, k: &Q) -> usize where K: Borrow, Q: Eq + Hash + ?Sized,