INNER CODE UNIT · Rust
push_bools
Tencent/TNN · third_party/flatbuffers/rust/flexbuffers/src/builder/mod.rs:237
fn push_bools(&mut self, xs: &[bool]) {
let length = Value::UInt(xs.len() as u64);
let width = length.width_or_child_width();
align(&mut self.buffer, width);
store_value(&mut self.buffer, length, width);
let address = self.buffer.len();
for &b in xs.iter() {
self.buffer.push(b as u8);
self.buffer.resize(self.buffer.len() + width as usize, 0);
}
self.values.push(Value::Reference {
fxb_type: FlexBufferType::VectorBool,
address,
child_width: width,
});
}
push_slice!(push_uints, u64, UInt, new_uint_vector);