(self, mut seq: A)
| 140 | } |
| 141 | |
| 142 | fn visit_seq<A>(self, mut seq: A) -> Result<Self::Value, A::Error> |
| 143 | where |
| 144 | A: serde::de::SeqAccess<'de>, |
| 145 | { |
| 146 | use serde::de::Error as _; |
| 147 | |
| 148 | let mut pool = StringPool::new(); |
| 149 | |
| 150 | if let Some(len) = seq.size_hint() { |
| 151 | pool.map.reserve(len).map_err(|oom| A::Error::custom(oom))?; |
| 152 | pool.strings |
| 153 | .reserve(len) |
| 154 | .map_err(|oom| A::Error::custom(oom))?; |
| 155 | } |
| 156 | |
| 157 | while let Some(s) = seq.next_element::<TryString>()? { |
| 158 | debug_assert_eq!(s.len(), s.capacity()); |
| 159 | let s = s.into_boxed_str().map_err(|oom| A::Error::custom(oom))?; |
| 160 | if !pool.map.contains_key(&*s) { |
| 161 | pool.insert_new_boxed_str(s) |
| 162 | .map_err(|oom| A::Error::custom(oom))?; |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | Ok(pool) |
| 167 | } |
| 168 | } |
| 169 | deserializer.deserialize_seq(Visitor) |
| 170 | } |
nothing calls this directly
no test coverage detected