From b6935b4f5fd4ab2adb773eb7feb97a3fce669056 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Thu, 25 Jul 2024 10:48:04 -0700 Subject: [PATCH] file tweaks --- src/file.rs | 5 ++++- src/lib.rs | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/file.rs b/src/file.rs index 786cef8..6f22cf9 100644 --- a/src/file.rs +++ b/src/file.rs @@ -84,6 +84,9 @@ impl File{ data:input, }) } + pub(crate) fn as_mut(&mut self)->&mut R{ + &mut self.data + } pub(crate) fn block_reader(&mut self,block_id:BlockId)->Result,Error>{ if self.header.block_location.len() as u32<=block_id.get(){ return Err(Error::InvalidBlockId(block_id)) @@ -91,7 +94,7 @@ impl File{ let block_start=self.header.block_location[block_id.get() as usize]; let block_end=self.header.block_location[block_id.get() as usize+1]; self.data.seek(std::io::SeekFrom::Start(block_start)).map_err(Error::Seek)?; - Ok((&mut self.data).take_seek(block_end-block_start)) + Ok(self.as_mut().take_seek(block_end-block_start)) } pub(crate) fn fourcc(&self)->FourCC{ self.header.fourcc diff --git a/src/lib.rs b/src/lib.rs index 4f4f479..90594ff 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,7 +2,7 @@ use binrw::BinReaderExt; mod newtypes; -pub mod file; +mod file; pub mod map; pub mod bot; pub mod demo;