Fix build on Darwin

This commit is contained in:
Pekka Enberg
2024-01-13 09:14:26 +02:00
parent 08b40f2af7
commit 9af2a285b1

View File

@@ -1,5 +1,6 @@
use super::Completion;
use anyhow::{Ok, Result};
use std::sync::Arc;
use std::cell::RefCell;
use std::io::{Read, Seek};
@@ -30,11 +31,12 @@ impl File {
pub fn pread(&self, pos: usize, c: Arc<Completion>) -> Result<()> {
let mut file = self.file.borrow_mut();
file.seek(std::io::SeekFrom::Start(pos as u64))?;
let buf = c.buf();
let mut buf = buf.as_mut_slice();
file.read_exact(buf)?;
drop(buf);
{
let mut buf = c.buf_mut();
let buf = buf.as_mut_slice();
file.read_exact(buf)?;
}
c.complete();
Ok(())
}
}
}