Skip to content

Commit

Permalink
Merge pull request #38 from JayKickliter/jsk/disktre-is-send
Browse files Browse the repository at this point in the history
Require DiskTreeMap to be Send + Sync + 'static
  • Loading branch information
JayKickliter committed Feb 16, 2024
2 parents cfdc1aa + ab252ab commit 4cff9c4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/disktree/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use memmap::MmapOptions;
use std::{
fs::File,
io::{Cursor, Read, Seek, SeekFrom},
marker::Send,
ops::Range,
path::Path,
};
Expand All @@ -17,7 +18,7 @@ pub(crate) const HDR_MAGIC: &[u8] = b"hextree\0";
pub(crate) const HDR_SZ: u64 = HDR_MAGIC.len() as u64 + 1;

/// An on-disk hextree map.
pub struct DiskTreeMap(Box<dyn AsRef<[u8]>>);
pub struct DiskTreeMap(Box<dyn AsRef<[u8]> + Send + Sync + 'static>);

impl DiskTreeMap {
/// Opens a `DiskTree` at the specified path.
Expand All @@ -36,7 +37,7 @@ impl DiskTreeMap {
/// Opens a `DiskTree` with a provided buffer.
pub fn with_buf<B>(buf: B) -> Result<Self>
where
B: AsRef<[u8]> + 'static,
B: AsRef<[u8]> + Send + Sync + 'static,
{
let mut csr = Cursor::new(buf);
let magic = {
Expand Down

0 comments on commit 4cff9c4

Please sign in to comment.