autocommit 2022-02-06 16:33:54 CET
This commit is contained in:
parent
c92346324b
commit
dc2cb71012
104 changed files with 2563 additions and 4617 deletions
|
|
@ -60,6 +60,7 @@ impl<'a> MsgFormatter<'a> {
|
|||
self.object(obj).uint(event)
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn array<F: FnOnce(&mut MsgFormatter<'_>)>(&mut self, f: F) -> &mut Self {
|
||||
let pos = self.buf.out_pos;
|
||||
self.uint(0);
|
||||
|
|
@ -81,6 +82,14 @@ impl<'a> MsgFormatter<'a> {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn binary<T: ?Sized>(&mut self, t: &T) -> &mut Self {
|
||||
self.uint(mem::size_of_val(t) as u32);
|
||||
self.buf.write(uapi::as_maybe_uninit_bytes(t));
|
||||
let none = [MaybeUninit::new(0); 4];
|
||||
self.buf.write(&none[..self.buf.out_pos.wrapping_neg() & 3]);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn write_len(self) {
|
||||
assert!(self.buf.out_pos - self.pos >= 8);
|
||||
assert_eq!(self.pos % 4, 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue