From 105c0ee3b47196ce298c65a0b7f61a52e4b92235 Mon Sep 17 00:00:00 2001 From: Aaron O'Mullan Date: Sat, 3 Apr 2021 02:12:10 +0200 Subject: [PATCH] perf(serde_v8/de): implement SeqAccess size_hint (#9975) --- serde_v8/src/de.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/serde_v8/src/de.rs b/serde_v8/src/de.rs index 0816514a67..4de2f58170 100644 --- a/serde_v8/src/de.rs +++ b/serde_v8/src/de.rs @@ -534,6 +534,10 @@ impl<'de> de::SeqAccess<'de> for SeqAccess<'_, '_, '_> { Ok(None) } } + + fn size_hint(&self) -> Option { + Some((self.len - self.pos) as usize) + } } struct EnumAccess<'a, 'b, 's> {