[−][src]Struct zbus::Message
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.
Implementations
impl Message
[src]
pub fn method<B>(
sender: Option<&str>,
destination: Option<&str>,
path: &str,
iface: Option<&str>,
method_name: &str,
body: &B
) -> Result<Self, MessageError> where
B: Serialize + Type,
[src]
sender: Option<&str>,
destination: Option<&str>,
path: &str,
iface: Option<&str>,
method_name: &str,
body: &B
) -> Result<Self, MessageError> where
B: Serialize + Type,
Create a message of type MessageType::MethodCall
.
pub fn signal<B>(
sender: Option<&str>,
destination: Option<&str>,
path: &str,
iface: &str,
signal_name: &str,
body: &B
) -> Result<Self, MessageError> where
B: Serialize + Type,
[src]
sender: Option<&str>,
destination: Option<&str>,
path: &str,
iface: &str,
signal_name: &str,
body: &B
) -> Result<Self, MessageError> where
B: Serialize + Type,
Create a message of type MessageType::Signal
.
pub fn method_reply<B>(
sender: Option<&str>,
call: &Self,
body: &B
) -> Result<Self, MessageError> where
B: Serialize + Type,
[src]
sender: Option<&str>,
call: &Self,
body: &B
) -> Result<Self, MessageError> where
B: Serialize + Type,
Create a message of type MessageType::MethodReturn
.
pub fn method_error<B>(
sender: Option<&str>,
call: &Self,
name: &str,
body: &B
) -> Result<Self, MessageError> where
B: Serialize + Type,
[src]
sender: Option<&str>,
call: &Self,
name: &str,
body: &B
) -> Result<Self, MessageError> where
B: Serialize + Type,
Create a message of type MessageType::MethodError
.
pub fn disown_fds(&mut self)
[src]
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.
pub fn body_signature(&self) -> Result<Signature<'_>, MessageError>
[src]
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.
pub fn primary_header(&self) -> Result<MessagePrimaryHeader, MessageError>
[src]
Deserialize the primary header.
pub fn header(&self) -> Result<MessageHeader<'_>, MessageError>
[src]
Deserialize the header.
pub fn fields(&self) -> Result<MessageFields<'_>, MessageError>
[src]
Deserialize the fields.
pub fn body_unchecked<'d, 'm: 'd, B>(&'m self) -> Result<B, MessageError> where
B: Deserialize<'d> + Type,
[src]
B: Deserialize<'d> + Type,
Deserialize the body (without checking signature matching).
pub fn body<'d, 'm: 'd, B>(&'m self) -> Result<B, MessageError> where
B: Deserialize<'d> + Type,
[src]
B: Deserialize<'d> + Type,
Check the signature and deserialize the body.
pub fn as_bytes(&self) -> &[u8]
[src]
Get a reference to the byte encoding of the message.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnwindSafe for Message
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,