MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / visit_seq

Method visit_seq

crates/environ/src/string_pool.rs:142–167  ·  view source on GitHub ↗
(self, mut seq: A)

Source from the content-addressed store, hash-verified

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 }

Callers

nothing calls this directly

Calls 7

OkFunction · 0.85
into_boxed_strMethod · 0.80
insert_new_boxed_strMethod · 0.80
newFunction · 0.50
size_hintMethod · 0.45
reserveMethod · 0.45
contains_keyMethod · 0.45

Tested by

no test coverage detected