Log

Struct Log 

Source
pub struct Log(/* private fields */);
Expand description

A Log signal.

Implementations§

Source§

impl Log

Source

pub fn from_message<M>(msg: M) -> Option<Self>
where M: Into<Arc<Message>>,

Try to construct a Log from a ::zbus::Message.

Source§

impl Log

Source

pub fn args<'s>(&'s self) -> Result<LogArgs<'s>>

Retrieve the signal arguments.

Methods from Deref<Target = Message>§

Source

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.

Source

pub fn primary_header(&self) -> &MessagePrimaryHeader

Source

pub fn header(&self) -> Result<MessageHeader<'_>, Error>

Deserialize the header.

Note: prefer using the direct access methods if possible; they are more efficient.

Source

pub fn fields(&self) -> Result<MessageFields<'_>, Error>

Deserialize the fields.

Note: prefer using the direct access methods if possible; they are more efficient.

Source

pub fn message_type(&self) -> MessageType

The message type.

Source

pub fn path(&self) -> Option<ObjectPath<'_>>

The object to send a call to, or the object a signal is emitted from.

Source

pub fn interface(&self) -> Option<InterfaceName<'_>>

The interface to invoke a method call on, or that a signal is emitted from.

Source

pub fn member(&self) -> Option<MemberName<'_>>

The member, either the method name or signal name.

Source

pub fn reply_serial(&self) -> Option<u32>

The serial number of the message this message is a reply to.

Source

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).

Source

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);
Source

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

Get a reference to the byte encoding of the message.

Source

pub fn body_as_bytes(&self) -> Result<&[u8], Error>

Get a reference to the byte encoding of the body of the message.

Source

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.

Trait Implementations§

Source§

impl AsRef<Arc<Message>> for Log

Source§

fn as_ref(&self) -> &Arc<Message>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<Message> for Log

Source§

fn as_ref(&self) -> &Message

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for Log

Source§

fn clone(&self) -> Log

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Log

Source§

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

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

impl Deref for Log

Source§

type Target = Message

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Message

Dereferences the value.

Auto Trait Implementations§

§

impl Freeze for Log

§

impl RefUnwindSafe for Log

§

impl Send for Log

§

impl Sync for Log

§

impl Unpin for Log

§

impl UnwindSafe for Log

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more