about summary refs log tree commit diff
path: root/compiler/rustc_serialize/src/serialize.rs
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2023-04-28 08:53:13 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2023-04-28 09:51:00 +1000
commit37c9e45186e00c197902a7c7349c18383aa0abf7 (patch)
treeda678fa52b3b826637a6c43be72fa6b65a684c54 /compiler/rustc_serialize/src/serialize.rs
parentb51deba9ac36ee2808af8a03fe8bc6fc570cc497 (diff)
downloadrust-37c9e45186e00c197902a7c7349c18383aa0abf7.tar.gz
rust-37c9e45186e00c197902a7c7349c18383aa0abf7.zip
Add a comment explaining the lack of `Decoder::read_enum_variant`.
Because I was wondering about it, and this may save a future person from
also wondering.
Diffstat (limited to 'compiler/rustc_serialize/src/serialize.rs')
-rw-r--r--compiler/rustc_serialize/src/serialize.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_serialize/src/serialize.rs b/compiler/rustc_serialize/src/serialize.rs
index a6d9c7b7d42..79c2f76c01c 100644
--- a/compiler/rustc_serialize/src/serialize.rs
+++ b/compiler/rustc_serialize/src/serialize.rs
@@ -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;
 }