Skip to content

Commit

Permalink
Add a comment explaining the lack of Decoder::read_enum_variant.
Browse files Browse the repository at this point in the history
Because I was wondering about it, and this may save a future person from
also wondering.
  • Loading branch information
nnethercote committed Apr 27, 2023
1 parent b51deba commit 37c9e45
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions compiler/rustc_serialize/src/serialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ pub trait Decoder {
fn read_char(&mut self) -> char;
fn read_str(&mut self) -> &str;
fn read_raw_bytes(&mut self, len: usize) -> &[u8];

// Although there is an `emit_enum_variant` method in `Encoder`, the code
// patterns in decoding are different enough to encoding that there is no
// need for a corresponding `read_enum_variant` method here.

fn peek_byte(&self) -> u8;
fn position(&self) -> usize;
}
Expand Down

0 comments on commit 37c9e45

Please # to comment.