pub struct MarshalledMessageBody { /* private fields */ }
Expand description
The body accepts everything that implements the Marshal trait (e.g. all basic types, strings, slices, Hashmaps,…..) And you can of course write an Marshal impl for your own datastrcutures
Implementations§
Source§impl MarshalledMessageBody
impl MarshalledMessageBody
Sourcepub fn with_byteorder(b: ByteOrder) -> Self
pub fn with_byteorder(b: ByteOrder) -> Self
New messagebody with a chosen byteorder
pub fn from_parts( buf: Vec<u8>, raw_fds: Vec<UnixFd>, sig: SignatureBuffer, byteorder: ByteOrder, ) -> Self
pub fn sig(&self) -> &str
pub fn buf(&self) -> &[u8] ⓘ
pub fn buf_arc(&self) -> Arc<Vec<u8>>
pub fn fds(&self) -> &[UnixFd]
pub fn byteorder(&self) -> ByteOrder
Sourcepub fn get_fds(&self) -> Vec<UnixFd>
pub fn get_fds(&self) -> Vec<UnixFd>
Get a clone of all the UnixFd
s in the body.
Some of the UnixFd
s may already have their RawFd
s taken.
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Clears the buffer and signature but holds on to the memory allocations. You can now start pushing new params as if this were a new message. This allows to reuse the OutMessage for the same dbus-message with different parameters without allocating the buffer every time.
Sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserves space for additional
bytes in the internal buffer. This is useful to reduce the amount of allocations done while marshalling,
if you can predict somewhat accuratly how many bytes you will be marshalling.
pub fn push_param_helper<F>(&mut self, push_fn: F) -> Result<(), Error>
Sourcepub fn push_param<P: Marshal>(&mut self, p: P) -> Result<(), Error>
pub fn push_param<P: Marshal>(&mut self, p: P) -> Result<(), Error>
Append something that is Marshal to the message body
Sourcepub fn push_param2<P1: Marshal, P2: Marshal>(
&mut self,
p1: P1,
p2: P2,
) -> Result<(), Error>
pub fn push_param2<P1: Marshal, P2: Marshal>( &mut self, p1: P1, p2: P2, ) -> Result<(), Error>
Append two things that are Marshal to the message body
Sourcepub fn push_param3<P1: Marshal, P2: Marshal, P3: Marshal>(
&mut self,
p1: P1,
p2: P2,
p3: P3,
) -> Result<(), Error>
pub fn push_param3<P1: Marshal, P2: Marshal, P3: Marshal>( &mut self, p1: P1, p2: P2, p3: P3, ) -> Result<(), Error>
Append three things that are Marshal to the message body
Sourcepub fn push_param4<P1: Marshal, P2: Marshal, P3: Marshal, P4: Marshal>(
&mut self,
p1: P1,
p2: P2,
p3: P3,
p4: P4,
) -> Result<(), Error>
pub fn push_param4<P1: Marshal, P2: Marshal, P3: Marshal, P4: Marshal>( &mut self, p1: P1, p2: P2, p3: P3, p4: P4, ) -> Result<(), Error>
Append four things that are Marshal to the message body
Sourcepub fn push_param5<P1: Marshal, P2: Marshal, P3: Marshal, P4: Marshal, P5: Marshal>(
&mut self,
p1: P1,
p2: P2,
p3: P3,
p4: P4,
p5: P5,
) -> Result<(), Error>
pub fn push_param5<P1: Marshal, P2: Marshal, P3: Marshal, P4: Marshal, P5: Marshal>( &mut self, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, ) -> Result<(), Error>
Append five things that are Marshal to the message body
Sourcepub fn push_params<P: Marshal>(&mut self, params: &[P]) -> Result<(), Error>
pub fn push_params<P: Marshal>(&mut self, params: &[P]) -> Result<(), Error>
Append any number of things that have the same type that is Marshal to the message body
Sourcepub fn push_variant<P: Marshal>(&mut self, p: P) -> Result<(), Error>
pub fn push_variant<P: Marshal>(&mut self, p: P) -> Result<(), Error>
Append something that is Marshal to the body but use a dbus Variant in the signature. This is necessary for some APIs
Sourcepub fn validate(&self) -> Result<(), Error>
pub fn validate(&self) -> Result<(), Error>
Validate the all the marshalled elements of the body.
Sourcepub fn parser(&self) -> MessageBodyParser<'_>
pub fn parser(&self) -> MessageBodyParser<'_>
Create a parser to retrieve parameters from the body.