diff options
author | Joey Sacchini <joey@sacchini.net> | 2021-01-07 13:57:21 -0500 |
---|---|---|
committer | Joey Sacchini <joey@sacchini.net> | 2021-01-07 13:57:21 -0500 |
commit | 298463659a38df8d1f17992851cb64c7309600a1 (patch) | |
tree | 806e83477177440c5b0a4d4298161d4642838e0c | |
parent | 3451193c972e0d6c8d145658d8b56fba1aa6cab5 (diff) | |
download | craftio-rs-298463659a38df8d1f17992851cb64c7309600a1.tar.gz craftio-rs-298463659a38df8d1f17992851cb64c7309600a1.tar.bz2 craftio-rs-298463659a38df8d1f17992851cb64c7309600a1.zip |
fix written data len function
-rw-r--r-- | src/writer.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/writer.rs b/src/writer.rs index 8d0fa58..4c0a302 100644 --- a/src/writer.rs +++ b/src/writer.rs @@ -607,7 +607,7 @@ struct GrowVecSerializer<'a> { impl<'a> Serializer for GrowVecSerializer<'a> { fn serialize_bytes(&mut self, data: &[u8]) -> SerializeResult { if !self.exceeded_max_size { - let cur_len = self.at - self.offset; + let cur_len = self.written_data_len(); let new_len = cur_len + data.len(); if new_len > self.max_size { self.exceeded_max_size = true; @@ -634,7 +634,7 @@ impl<'a> GrowVecSerializer<'a> { } fn written_data_len(&self) -> usize { - self.at - self.offset + self.at } } |