Struct MarshalledMessageBody

Source
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

Source

pub fn new() -> Self

New messagebody with the default little endian byteorder

Source

pub fn with_byteorder(b: ByteOrder) -> Self

New messagebody with a chosen byteorder

Source

pub fn from_parts( buf: Vec<u8>, raw_fds: Vec<UnixFd>, sig: SignatureBuffer, byteorder: ByteOrder, ) -> Self

Source

pub fn sig(&self) -> &str

Source

pub fn buf(&self) -> &[u8]

Source

pub fn buf_arc(&self) -> Arc<Vec<u8>>

Source

pub fn fds(&self) -> &[UnixFd]

Source

pub fn byteorder(&self) -> ByteOrder

Source

pub fn get_fds(&self) -> Vec<UnixFd>

Get a clone of all the UnixFds in the body.

Some of the UnixFds may already have their RawFds taken.

Source

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.

Source

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.

Source

pub fn push_param_helper<F>(&mut self, push_fn: F) -> Result<(), Error>
where F: FnOnce(&mut MarshalContext<'_, '_>, &mut SignatureBuffer) -> Result<(), Error>,

Source

pub fn push_param<P: Marshal>(&mut self, p: P) -> Result<(), Error>

Append something that is Marshal to the message body

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

pub fn validate(&self) -> Result<(), Error>

Validate the all the marshalled elements of the body.

Source

pub fn parser(&self) -> MessageBodyParser<'_>

Create a parser to retrieve parameters from the body.

Trait Implementations§

Source§

impl Debug for MarshalledMessageBody

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MarshalledMessageBody

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.