Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require DiskTreeMap to be Send + Sync + 'static #38

Merged
merged 3 commits into from
Feb 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading