Skip to content

Commit

Permalink
add Slice::slice
Browse files Browse the repository at this point in the history
  • Loading branch information
marvin-j97 committed Jan 21, 2025
1 parent ab7c10b commit 58da075
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "value-log"
description = "Value log implementation for key-value separated LSM storage"
license = "MIT OR Apache-2.0"
version = "1.4.1"
version = "1.5.0"
edition = "2021"
rust-version = "1.74.0"
readme = "README.md"
Expand Down
6 changes: 6 additions & 0 deletions src/slice/slice_arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ impl Slice {
Self(bytes.into())
}

#[doc(hidden)]
#[must_use]
pub fn slice(&self, range: impl std::ops::RangeBounds<usize>) -> Self {
Self(self.0.slice(range))
}

#[must_use]
#[doc(hidden)]
pub fn with_size(len: usize) -> Self {
Expand Down
6 changes: 6 additions & 0 deletions src/slice/slice_bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ impl Slice {
Self(Bytes::copy_from_slice(bytes))
}

#[doc(hidden)]
#[must_use]
pub fn slice(&self, range: impl std::ops::RangeBounds<usize>) -> Self {
Self(self.0.slice(range))
}

#[doc(hidden)]
pub fn from_reader<R: std::io::Read>(reader: &mut R, len: usize) -> std::io::Result<Self> {
let mut builder = BytesMut::zeroed(len);
Expand Down

0 comments on commit 58da075

Please sign in to comment.