autocommit 2022-01-04 15:30:21 CET
This commit is contained in:
parent
30376c595c
commit
cbbc41a463
40 changed files with 725 additions and 189 deletions
|
|
@ -1,7 +1,7 @@
|
|||
use crate::object::ObjectId;
|
||||
use crate::utils::buffd::buf_out::{BufFdOut, MsgFds};
|
||||
use std::mem;
|
||||
use std::mem::{MaybeUninit};
|
||||
use std::mem::MaybeUninit;
|
||||
use uapi::OwnedFd;
|
||||
|
||||
pub struct MsgFormatter<'a> {
|
||||
|
|
@ -50,11 +50,11 @@ impl<'a> MsgFormatter<'a> {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn object(&mut self, obj: ObjectId) -> &mut Self {
|
||||
self.uint(obj.raw())
|
||||
pub fn object<T: Into<ObjectId>>(&mut self, obj: T) -> &mut Self {
|
||||
self.uint(obj.into().raw())
|
||||
}
|
||||
|
||||
pub fn header(&mut self, obj: ObjectId, event: u32) -> &mut Self {
|
||||
pub fn header<T: Into<ObjectId>>(&mut self, obj: T, event: u32) -> &mut Self {
|
||||
self.object(obj).uint(event)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,8 +46,11 @@ impl<'a, 'b> MsgParser<'a, 'b> {
|
|||
self.int().map(|i| i as u32)
|
||||
}
|
||||
|
||||
pub fn object(&mut self) -> Result<ObjectId, MsgParserError> {
|
||||
self.int().map(|i| ObjectId::from_raw(i as u32))
|
||||
pub fn object<T>(&mut self) -> Result<T, MsgParserError>
|
||||
where
|
||||
ObjectId: Into<T>,
|
||||
{
|
||||
self.int().map(|i| ObjectId::from_raw(i as u32).into())
|
||||
}
|
||||
|
||||
pub fn global(&mut self) -> Result<GlobalName, MsgParserError> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue