pub struct Changed(_);
Expand description

A Changed signal.

Implementations§

source§

impl Changed

source

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

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

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 Changed

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 Changed

source§

fn as_ref(&self) -> &Message

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

impl Clone for Changed

source§

fn clone(&self) -> Changed

Returns a copy 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 Changed

source§

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

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

impl Deref for Changed

§

type Target = Message

The resulting type after dereferencing.
source§

fn deref(&self) -> &Message

Dereferences the value.

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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> 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 Twhere 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> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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

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

§

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