Refactoring reading a bit

This commit is contained in:
Igor Katson 2021-06-28 15:44:29 +01:00
parent a799ff1219
commit 2192842099
2 changed files with 14 additions and 4 deletions

View file

@ -57,9 +57,9 @@ impl<ByteBuf> Piece<ByteBuf>
where
ByteBuf: AsRef<[u8]>,
{
pub fn from_vec(index: u32, begin: u32, block: Vec<u8>) -> Piece<ByteBuf>
pub fn from_data<T>(index: u32, begin: u32, block: T) -> Piece<ByteBuf>
where
ByteBuf: From<Vec<u8>>,
ByteBuf: From<T>,
{
Piece {
index,