Commit 7c6ba687 authored by Romain Vimont's avatar Romain Vimont Committed by Romain Vimont

Implement Index<BlockOffset> for FrameBlocks

For convenience, implement Index and IndexMut traits so that we can
index a block directly by a BlockOffset instance.
parent b14c663b
......@@ -1422,6 +1422,23 @@ impl IndexMut<usize> for FrameBlocks {
}
}
// for convenience, also index by BlockOffset
impl Index<BlockOffset> for FrameBlocks {
type Output = Block;
#[inline]
fn index(&self, bo: BlockOffset) -> &Self::Output {
&self[bo.y][bo.x]
}
}
impl IndexMut<BlockOffset> for FrameBlocks {
#[inline]
fn index_mut(&mut self, bo: BlockOffset) -> &mut Self::Output {
&mut self[bo.y][bo.x]
}
}
#[derive(Clone)]
pub struct BlockContextCheckpoint {
cdef_coded: bool,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment