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