pub struct Log(/* private fields */);Expand description
A Log signal.
Implementations§
Source§impl Log
impl Log
Sourcepub fn from_message<M>(msg: M) -> Option<Self>
pub fn from_message<M>(msg: M) -> Option<Self>
Try to construct a Log from a ::zbus::Message.
Methods from Deref<Target = Message>§
Sourcepub fn body_signature(&self) -> Result<Signature<'_>, Error>
pub fn body_signature(&self) -> Result<Signature<'_>, Error>
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) -> &MessagePrimaryHeader
Sourcepub fn header(&self) -> Result<MessageHeader<'_>, Error>
pub fn header(&self) -> Result<MessageHeader<'_>, Error>
Deserialize the header.
Note: prefer using the direct access methods if possible; they are more efficient.
Sourcepub fn fields(&self) -> Result<MessageFields<'_>, Error>
pub fn fields(&self) -> Result<MessageFields<'_>, Error>
Deserialize the fields.
Note: prefer using the direct access methods if possible; they are more efficient.
Sourcepub fn message_type(&self) -> MessageType
pub fn message_type(&self) -> MessageType
The message type.
Sourcepub fn path(&self) -> Option<ObjectPath<'_>>
pub fn path(&self) -> Option<ObjectPath<'_>>
The object to send a call to, or the object a signal is emitted from.
Sourcepub fn interface(&self) -> Option<InterfaceName<'_>>
pub fn interface(&self) -> Option<InterfaceName<'_>>
The interface to invoke a method call on, or that a signal is emitted from.
Sourcepub fn member(&self) -> Option<MemberName<'_>>
pub fn member(&self) -> Option<MemberName<'_>>
The member, either the method name or signal name.
Sourcepub fn reply_serial(&self) -> Option<u32>
pub fn reply_serial(&self) -> Option<u32>
The serial number of the message this message is a reply to.
Sourcepub fn body_unchecked<'d, 'm, B>(&'m self) -> Result<B, Error>where
'm: 'd,
B: Deserialize<'d> + Type,
pub fn body_unchecked<'d, 'm, B>(&'m self) -> Result<B, Error>where
'm: 'd,
B: Deserialize<'d> + Type,
Deserialize the body (without checking signature matching).
Sourcepub fn body<'d, 'm, B>(&'m self) -> Result<B, Error>where
'm: 'd,
B: DynamicDeserialize<'d>,
pub fn body<'d, 'm, B>(&'m self) -> Result<B, Error>where
'm: 'd,
B: DynamicDeserialize<'d>,
Deserialize the body using the contained signature.
§Example
let send_body = (7i32, (2i32, "foo"), vec!["bar"]);
let message = Message::method(None::<&str>, Some("zbus.test"), "/", Some("zbus.test"), "ping", &send_body)?;
let body : zbus::zvariant::Structure = message.body()?;
let fields = body.fields();
assert!(matches!(fields[0], zvariant::Value::I32(7)));
assert!(matches!(fields[1], zvariant::Value::Structure(_)));
assert!(matches!(fields[2], zvariant::Value::Array(_)));
let reply_msg = Message::method_reply(None::<&str>, &message, &body)?;
let reply_value : (i32, (i32, &str), Vec<String>) = reply_msg.body()?;
assert_eq!(reply_value.0, 7);
assert_eq!(reply_value.2.len(), 1);Sourcepub fn body_as_bytes(&self) -> Result<&[u8], Error>
pub fn body_as_bytes(&self) -> Result<&[u8], Error>
Get a reference to the byte encoding of the body of the message.
Sourcepub fn recv_position(&self) -> MessageSequence
pub fn recv_position(&self) -> MessageSequence
Get the receive ordering of a message.
This may be used to identify how two events were ordered on the bus. It only produces a
useful ordering for messages that were produced by the same zbus::Connection.
This is completely unrelated to the serial number on the message, which is set by the peer and might not be ordered at all.