1
Fork 0

rustc_serialize: specialize opaque encoding of some u8 sequences

This commit is contained in:
Tyson Nottingham 2020-12-16 19:03:31 -08:00
parent 417fe47065
commit a4daa63a90
6 changed files with 32 additions and 21 deletions

View file

@ -527,7 +527,7 @@ impl<D: Decoder, T: Decodable<D>> Decodable<D> for Rc<T> {
}
impl<S: Encoder, T: Encodable<S>> Encodable<S> for [T] {
fn encode(&self, s: &mut S) -> Result<(), S::Error> {
default fn encode(&self, s: &mut S) -> Result<(), S::Error> {
s.emit_seq(self.len(), |s| {
for (i, e) in self.iter().enumerate() {
s.emit_seq_elt(i, |s| e.encode(s))?