INNER CODE UNIT · Rust
Some
Tencent/TNN · third_party/flatbuffers/rust/flexbuffers/src/builder/mod.rs:166
if let Some(pool) = self.key_pool.as_mut() {
pool.clear();
}
}
fn push_key(&mut self, key: &str) {
debug_assert!(
key.bytes().all(|b| b != b'\0'),
"Keys must not have internal nulls."
);
// Search key pool if there is one.
let found = self.key_pool.as_ref().map(|pool| {
pool.binary_search_by(|&CachedKey(addr)| {
let old_key = map::get_key(&self.buffer, addr);
old_key.cloned().cmp(key.bytes())
})
});
let address = if let Some(Ok(idx)) = found {
// Found key in key pool.