mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-01-27 21:43:14 +08:00
23 lines
416 B
Rust
23 lines
416 B
Rust
|
use std::sync::Arc;
|
||
|
|
||
|
use memmap::Mmap;
|
||
|
|
||
|
#[derive(Debug, Clone)]
|
||
|
pub struct ClonableMmap {
|
||
|
inner: Arc<Mmap>,
|
||
|
}
|
||
|
|
||
|
impl AsRef<[u8]> for ClonableMmap {
|
||
|
fn as_ref(&self) -> &[u8] {
|
||
|
self.inner.as_ref()
|
||
|
}
|
||
|
}
|
||
|
|
||
|
impl From<Mmap> for ClonableMmap {
|
||
|
fn from(inner: Mmap) -> ClonableMmap {
|
||
|
ClonableMmap { inner: Arc::new(inner) }
|
||
|
}
|
||
|
}
|
||
|
|
||
|
pub type CursorClonableMmap = std::io::Cursor<ClonableMmap>;
|