Add tests for task 1 and 2
This commit is contained in:
10
src/block.rs
10
src/block.rs
@@ -1,3 +1,5 @@
|
||||
use std::ops;
|
||||
|
||||
use Result;
|
||||
use binread::BinReadable;
|
||||
|
||||
@@ -45,6 +47,14 @@ impl Block {
|
||||
}
|
||||
}
|
||||
|
||||
impl ops::Index<usize> for Block {
|
||||
type Output = u8;
|
||||
|
||||
fn index(&self, index: usize) -> &<Self as ops::Index<usize>>::Output {
|
||||
return &self.source[index];
|
||||
}
|
||||
}
|
||||
|
||||
impl BinReadable for Block {
|
||||
fn get(&mut self) -> Result<u8> {
|
||||
if self.pointer >= self.length {
|
||||
|
||||
Reference in New Issue
Block a user