metainfo parsing
This commit is contained in:
@@ -46,7 +46,7 @@ fn decode_object(buf: &mut Buffer) -> DecodeResult<Object> {
|
||||
}
|
||||
list.push(decode_object(buf)?);
|
||||
}
|
||||
Ok(List::new(list))
|
||||
Ok(List::wrap(list))
|
||||
}
|
||||
Some(b'd') => {
|
||||
buf.advance(1);
|
||||
@@ -60,7 +60,7 @@ fn decode_object(buf: &mut Buffer) -> DecodeResult<Object> {
|
||||
let val = decode_object(buf)?;
|
||||
dict.insert(Bytes(key), val);
|
||||
}
|
||||
Ok(Dict::new(dict))
|
||||
Ok(Dict::wrap(dict))
|
||||
}
|
||||
_ => Err(DecodeError),
|
||||
}
|
||||
@@ -84,7 +84,7 @@ fn _decode_int(buf: &mut Buffer, term: u8) -> DecodeResult<i64> {
|
||||
}
|
||||
|
||||
fn decode_bytes(buf: &mut Buffer) -> DecodeResult<Object> {
|
||||
_decode_bytes(buf).map(|bytes| Bytes::new(bytes))
|
||||
_decode_bytes(buf).map(|bytes| Bytes::wrap(bytes))
|
||||
}
|
||||
|
||||
fn _decode_bytes(buf: &mut Buffer) -> Result<Vec<u8>, DecodeError> {
|
||||
@@ -116,7 +116,7 @@ fn test_int_neg() {
|
||||
fn test_bytes() {
|
||||
let mut buf = Buffer::new(b"5:hello");
|
||||
|
||||
assert_eq!(decode_bytes(&mut buf).unwrap(), Bytes::new(b"hello".to_vec()));
|
||||
assert_eq!(decode_bytes(&mut buf).unwrap(), Bytes::wrap(b"hello".to_vec()));
|
||||
assert_eq!(buf.pos(), 7);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user