byte_buffer: remove requirement to pass Cursor to ByteBufferWrite

This commit is contained in:
Matt Bilker
2018-07-07 17:03:59 -04:00
parent e7b97ca5e2
commit d2da2183bc
2 changed files with 4 additions and 4 deletions

View File

@@ -144,9 +144,9 @@ impl<R: AsRef<[u8]>> ByteBufferRead<R> {
}
impl ByteBufferWrite {
pub fn new(buffer: Cursor<Vec<u8>>) -> Self {
pub fn new(buffer: Vec<u8>) -> Self {
Self {
buffer,
buffer: Cursor::new(buffer),
offset_1: 0,
offset_2: 0,
}

View File

@@ -334,8 +334,8 @@ impl KbinXml {
header.write_u8(encoding).context(KbinErrorKind::HeaderWrite("encoding"))?;
header.write_u8(0xFF ^ encoding).context(KbinErrorKind::HeaderWrite("encoding negation"))?;
let mut node_buf = ByteBufferWrite::new(Cursor::new(Vec::new()));
let mut data_buf = ByteBufferWrite::new(Cursor::new(Vec::new()));
let mut node_buf = ByteBufferWrite::new(Vec::new());
let mut data_buf = ByteBufferWrite::new(Vec::new());
self.write_node(&mut node_buf, &mut data_buf, input)?;