change api for no reason

This commit is contained in:
Quaternions 2024-12-31 04:32:39 -08:00
parent 0dc2d1f89e
commit f8c623cd88
2 changed files with 3 additions and 3 deletions

View File

@ -92,7 +92,7 @@ impl<R:BinReaderExt> File<R>{
data:input, data:input,
}) })
} }
pub(crate) fn as_mut(&mut self)->&mut R{ pub(crate) fn data_mut(&mut self)->&mut R{
&mut self.data &mut self.data
} }
pub(crate) fn block_reader(&mut self,block_id:BlockId)->Result<binrw::io::TakeSeek<&mut R>,Error>{ pub(crate) fn block_reader(&mut self,block_id:BlockId)->Result<binrw::io::TakeSeek<&mut R>,Error>{
@ -102,7 +102,7 @@ impl<R:BinReaderExt> File<R>{
let block_start=self.header.block_location[block_id.get() as usize]; 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]; 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)?; self.data.seek(std::io::SeekFrom::Start(block_start)).map_err(Error::Seek)?;
Ok(self.as_mut().take_seek(block_end-block_start)) Ok(self.data_mut().take_seek(block_end-block_start))
} }
pub(crate) fn fourcc(&self)->FourCC{ pub(crate) fn fourcc(&self)->FourCC{
self.header.fourcc self.header.fourcc

View File

@ -214,7 +214,7 @@ pub struct StreamableMap<R:BinReaderExt>{
impl<R:BinReaderExt> StreamableMap<R>{ impl<R:BinReaderExt> StreamableMap<R>{
pub(crate) fn new(mut file:crate::file::File<R>)->Result<Self,Error>{ pub(crate) fn new(mut file:crate::file::File<R>)->Result<Self,Error>{
//assume the file seek is in the right place to start reading a map header //assume the file seek is in the right place to start reading a map header
let header:MapHeader=file.as_mut().read_le().map_err(Error::InvalidHeader)?; let header:MapHeader=file.data_mut().read_le().map_err(Error::InvalidHeader)?;
let modes=header.modes.into_iter().map(TryInto::try_into).collect::<Result<_,_>>().map_err(Error::InvalidMode)?; let modes=header.modes.into_iter().map(TryInto::try_into).collect::<Result<_,_>>().map_err(Error::InvalidMode)?;
let attributes=header.attributes.into_iter().map(Into::into).collect(); let attributes=header.attributes.into_iter().map(Into::into).collect();
let render_configs=header.render_configs.into_iter().map(Into::into).collect(); let render_configs=header.render_configs.into_iter().map(Into::into).collect();