Solve challenge 12.
This commit is contained in:
@@ -16,8 +16,8 @@ impl Bytes {
|
||||
String::from(std::str::from_utf8(&v).unwrap())
|
||||
}
|
||||
|
||||
pub fn first_block(&self, length: usize) -> Bytes {
|
||||
Bytes(self.0[0..length].to_vec())
|
||||
pub fn get_block(&self, block_index: usize, block_size: usize) -> Bytes {
|
||||
Bytes(self.0[(block_index * block_size)..(block_index + 1) * block_size].to_vec())
|
||||
}
|
||||
|
||||
pub fn random(length: usize) -> Bytes {
|
||||
|
||||
Reference in New Issue
Block a user