rename function

This commit is contained in:
Quaternions 2024-07-23 17:18:03 -07:00
parent ec5bb74d46
commit e0e635e083
3 changed files with 4 additions and 4 deletions

View File

@ -90,8 +90,8 @@ impl<R:BinReaderExt> StreamableBot<R>{
}
pub fn load_segment(&mut self,segment_id:SegmentId)->Result<Segment,Error>{
let block_id=*self.segment_id_to_block_id.get(segment_id.get() as usize).ok_or(Error::InvalidSegmentId(segment_id))?;
let mut block=self.file.take_block(block_id).map_err(Error::File)?;
let mut block=self.file.block_reader(block_id).map_err(Error::File)?;
let segment=block.read_le().map_err(Error::InvalidSegment)?;
Ok(segment)
}
}
}

View File

@ -82,7 +82,7 @@ impl<R:BinReaderExt> File<R>{
data:input,
})
}
pub(crate) fn take_block(&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>{
if self.header.block_location.len() as u32<=block_id.get(){
return Err(Error::InvalidBlockId(block_id))
}

View File

@ -112,7 +112,7 @@ impl<R:BinReaderExt> StreamableMap<R>{
//load resources into self.resources
//return Region
let block_id=*self.node_id_to_block_id.get(node_id.get() as usize).ok_or(Error::InvalidBvhNodeId(node_id))?;
let mut block=self.file.take_block(block_id).map_err(Error::File)?;
let mut block=self.file.block_reader(block_id).map_err(Error::File)?;
let region:Region=block.read_le().map_err(Error::InvalidRegion)?;
Ok(region.models)
}