Struct zbus::Message [−][src]
pub struct Message { /* fields omitted */ }
Expand description
A D-Bus Message.
The content of the message are stored in serialized format. To deserialize the body of the
message, use the body
method. You may also access the header and other details with the
various other getters.
Also provided are constructors for messages of different types. These will mainly be useful for
very advanced use cases as typically you will want to create a message for immediate dispatch
and hence use the API provided by Connection
, even when using the low-level API.
Note: The message owns the received FDs and will close them when dropped. You can call
disown_fds
after deserializing to RawFD
using body
if you want to take the ownership.
Moreover, a clone of a message with owned FDs will only receive unowned copies of the FDs.
Implementations
pub fn method<'s, 'd, 'p, 'i, 'm, S, D, P, I, M, B>(
sender: Option<S>,
destination: Option<D>,
path: P,
iface: Option<I>,
method_name: M,
body: &B
) -> Result<Self> where
S: TryInto<UniqueName<'s>>,
D: TryInto<BusName<'d>>,
P: TryInto<ObjectPath<'p>>,
I: TryInto<InterfaceName<'i>>,
M: TryInto<MemberName<'m>>,
S::Error: Into<Error>,
D::Error: Into<Error>,
P::Error: Into<Error>,
I::Error: Into<Error>,
M::Error: Into<Error>,
B: Serialize + Type,
pub fn method<'s, 'd, 'p, 'i, 'm, S, D, P, I, M, B>(
sender: Option<S>,
destination: Option<D>,
path: P,
iface: Option<I>,
method_name: M,
body: &B
) -> Result<Self> where
S: TryInto<UniqueName<'s>>,
D: TryInto<BusName<'d>>,
P: TryInto<ObjectPath<'p>>,
I: TryInto<InterfaceName<'i>>,
M: TryInto<MemberName<'m>>,
S::Error: Into<Error>,
D::Error: Into<Error>,
P::Error: Into<Error>,
I::Error: Into<Error>,
M::Error: Into<Error>,
B: Serialize + Type,
Create a message of type MessageType::MethodCall
.
pub fn signal<'s, 'd, 'p, 'i, 'm, S, D, P, I, M, B>(
sender: Option<S>,
destination: Option<D>,
path: P,
iface: I,
signal_name: M,
body: &B
) -> Result<Self> where
S: TryInto<UniqueName<'s>>,
D: TryInto<BusName<'d>>,
P: TryInto<ObjectPath<'p>>,
I: TryInto<InterfaceName<'i>>,
M: TryInto<MemberName<'m>>,
S::Error: Into<Error>,
D::Error: Into<Error>,
P::Error: Into<Error>,
I::Error: Into<Error>,
M::Error: Into<Error>,
B: Serialize + Type,
pub fn signal<'s, 'd, 'p, 'i, 'm, S, D, P, I, M, B>(
sender: Option<S>,
destination: Option<D>,
path: P,
iface: I,
signal_name: M,
body: &B
) -> Result<Self> where
S: TryInto<UniqueName<'s>>,
D: TryInto<BusName<'d>>,
P: TryInto<ObjectPath<'p>>,
I: TryInto<InterfaceName<'i>>,
M: TryInto<MemberName<'m>>,
S::Error: Into<Error>,
D::Error: Into<Error>,
P::Error: Into<Error>,
I::Error: Into<Error>,
M::Error: Into<Error>,
B: Serialize + Type,
Create a message of type MessageType::Signal
.
Create a message of type MessageType::MethodReturn
.
Create a message of type MessageType::MethodError
.
Disown the associated file descriptors.
When a message is received over a AF_UNIX socket, it may contain associated FDs. To prevent the message from closing those FDs on drop, you may remove the ownership thanks to this method, after that you are responsible for closing them.
The signature of the body.
Note: While zbus treats multiple arguments as a struct (to allow you to use the tuple syntax), D-Bus does not. Since this method gives you the signature expected on the wire by D-Bus, the trailing and leading STRUCT signature parenthesis will not be present in case of multiple arguments.
Deserialize the header.
Deserialize the fields.
Deserialize the body (without checking signature matching).
Check the signature and deserialize the body.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Message
impl UnwindSafe for Message
Blanket Implementations
Mutably borrows from an owned value. Read more