fix drain

This commit is contained in:
Edward Shen 2021-03-01 16:37:34 -05:00
parent cd2f58c920
commit e9598831cc
Signed by: edward
GPG key ID: 19182661E818369F

View file

@ -97,8 +97,7 @@ impl MutableValue<'_, '_, '_> {
/// the Value event(s) are replaced with a single new event containing the /// the Value event(s) are replaced with a single new event containing the
/// new value. /// new value.
pub fn set_bytes(&mut self, input: Vec<u8>) { pub fn set_bytes(&mut self, input: Vec<u8>) {
self.section.drain(self.index..self.size); self.section.drain(self.index..self.index + self.size);
self.size = 1; self.size = 1;
self.section self.section
.insert(self.index, Event::Value(Cow::Owned(input))); .insert(self.index, Event::Value(Cow::Owned(input)));