MCPcopy Create free account
hub / github.com/SoftbearStudios/bitcode / inner

Method inner

src/derive/vec.rs:169–191  ·  view source on GitHub ↗
(
                me: &mut VecEncoder<T>,
                i: I,
            )

Source from the content-addressed store, hash-verified

167 /// Convert impl trait to named generic type.
168 #[inline(always)]
169 fn inner<'a, T: Encode + 'a, I: Iterator<Item = &'a [T]> + Clone>(
170 me: &mut VecEncoder<T>,
171 i: I,
172 ) {
173 unsafe {
174 // We can't set this in the Default constructor because we don't have the type I.
175 if me.vectored_impl.is_none() {
176 // Use match to avoid "use of generic parameter from outer function".
177 // Start at the pointer size (assumed to be 8 bytes) to not be wasteful.
178 me.vectored_impl =
179 std::mem::transmute(match (8 / std::mem::size_of::<T>()).max(1) {
180 1 => VecEncoder::encode_vectored_max_len::<I, 1>,
181 2 => VecEncoder::encode_vectored_max_len::<I, 2>,
182 4 => VecEncoder::encode_vectored_max_len::<I, 4>,
183 8 => VecEncoder::encode_vectored_max_len::<I, 8>,
184 _ => unreachable!(),
185 }
186 as fn(&mut VecEncoder<T>, I));
187 }
188 let f: fn(&mut VecEncoder<T>, I) = std::mem::transmute(me.vectored_impl);
189 f(me, i);
190 }
191 }
192 inner(self, i);
193 } else {
194 for v in i {

Callers

nothing calls this directly

Calls 1

fFunction · 0.85

Tested by

no test coverage detected