Records and sequences don't need a pushed state

This commit is contained in:
Tony Garnock-Jones 2022-10-29 12:41:22 +02:00
parent 0ffb44e8cb
commit d5dd02356b
1 changed files with 3 additions and 10 deletions

View File

@ -140,8 +140,6 @@ impl<W: io::Write> Writer for PackedWriter<W>
fn boundary(&mut self, b: &B::Type) -> io::Result<()> {
match b.closing {
Some(B::Item::DictionaryValue) |
Some(B::Item::RecordField) |
Some(B::Item::SequenceValue) |
Some(B::Item::SetValue) =>
self.shift(),
_ =>
@ -336,25 +334,21 @@ impl<W: io::Write> Writer for PackedWriter<W>
#[inline(always)]
fn start_record(&mut self) -> io::Result<()> {
self.write_tag(Tag::Record)?;
self.push()
self.write_tag(Tag::Record)
}
#[inline(always)]
fn end_record(&mut self) -> io::Result<()> {
self.pop(false)?;
self.write_tag(Tag::End)
}
#[inline(always)]
fn start_sequence(&mut self) -> io::Result<()> {
self.write_tag(Tag::Sequence)?;
self.push()
self.write_tag(Tag::Sequence)
}
#[inline(always)]
fn end_sequence(&mut self) -> io::Result<()> {
self.pop(false)?;
self.write_tag(Tag::End)
}
@ -384,8 +378,7 @@ impl<W: io::Write> Writer for PackedWriter<W>
#[inline(always)]
fn start_embedded(&mut self) -> io::Result<()> {
self.write_tag(Tag::Embedded)?;
Ok(())
self.write_tag(Tag::Embedded)
}
#[inline(always)]