Struct zbus::OwnedMatchRule

source ·
pub struct OwnedMatchRule(_);
Expand description

Owned sibling of MatchRule.

Implementations§

source§

impl OwnedMatchRule

source

pub fn into_inner(self) -> MatchRule<'static>

Convert to the inner MatchRule, consuming self.

source

pub fn inner(&self) -> &MatchRule<'static>

Get a reference to the inner MatchRule.

Methods from Deref<Target = MatchRule<'static>>§

source

pub fn sender(&self) -> Option<&BusName<'_>>

The sender, if set.

source

pub fn msg_type(&self) -> Option<MessageType>

The message type, if set.

source

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

The interfac, if set.

source

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

The member name if set.

source

pub fn path_spec(&self) -> Option<&MatchRulePathSpec<'_>>

The path or path namespace, if set.

source

pub fn destination(&self) -> Option<&UniqueName<'_>>

The destination, if set.

source

pub fn args(&self) -> &[(u8, Str<'_>)]

The arguments.

source

pub fn arg_paths(&self) -> &[(u8, ObjectPath<'_>)]

The argument paths.

source

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

Match messages whose first argument is within the specified namespace.

Note that while the spec allows this to be any string that’s a valid bus or interface name except that it can have no ., we only allow valid interface names. The reason is not only to keep things simple and type safe at the same time but also for the fact that use cases of only matching on the first component of a bus or interface name are unheard of.

source

pub fn to_owned(&self) -> MatchRule<'static>

Creates an owned clone of self.

source

pub fn matches(&self, msg: &Message) -> Result<bool>

Match the given message against this rule.

Caveats

Since this method doesn’t have any knowledge of names on the bus (or even connection to a bus) matching always succeeds for:

  • sender in the rule (if set) that is a well-known name. The sender on a message is always a unique name.
  • destination in the rule when destination on the msg is a well-known name. The destination on match rule is always a unique name.

Trait Implementations§

source§

impl Clone for OwnedMatchRule

source§

fn clone(&self) -> OwnedMatchRule

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 OwnedMatchRule

source§

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

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

impl Deref for OwnedMatchRule

§

type Target = MatchRule<'static>

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<'de> Deserialize<'de> for OwnedMatchRule

source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<'unowned, 'owned: 'unowned> From<&'owned OwnedMatchRule> for MatchRule<'unowned>

source§

fn from(rule: &'owned OwnedMatchRule) -> Self

Converts to this type from the input type.
source§

impl From<MatchRule<'_>> for OwnedMatchRule

source§

fn from(rule: MatchRule<'_>) -> Self

Converts to this type from the input type.
source§

impl From<OwnedMatchRule> for MatchRule<'static>

source§

fn from(o: OwnedMatchRule) -> Self

Converts to this type from the input type.
source§

impl Hash for OwnedMatchRule

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq<MatchRule<'_>> for OwnedMatchRule

source§

fn eq(&self, other: &MatchRule<'_>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<OwnedMatchRule> for OwnedMatchRule

source§

fn eq(&self, other: &OwnedMatchRule) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for OwnedMatchRule

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl TryFrom<&str> for OwnedMatchRule

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &str) -> Result<Self>

Performs the conversion.
source§

impl Type for OwnedMatchRule

source§

fn signature() -> Signature<'static>

Get the signature for the implementing type. Read more
source§

impl Eq for OwnedMatchRule

source§

impl StructuralEq for OwnedMatchRule

source§

impl StructuralPartialEq for OwnedMatchRule

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,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<'de, T> DynamicDeserialize<'de> for Twhere T: Type + Deserialize<'de> + ?Sized,

§

type Deserializer = PhantomData<T>

A DeserializeSeed implementation for this type.
source§

fn deserializer_for_signature<S>( signature: S ) -> Result<<T as DynamicDeserialize<'de>>::Deserializer, Error>where S: TryInto<Signature<'de>>, <S as TryInto<Signature<'de>>>::Error: Into<Error>,

Get a deserializer compatible with this signature.
source§

impl<T> DynamicType for Twhere T: Type + ?Sized,

source§

fn dynamic_signature(&self) -> Signature<'_>

Get the signature for the implementing type. Read more
source§

impl<T> From<T> for T

const: unstable · 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>,

const: unstable · 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.
const: unstable · 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.
const: unstable · 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
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,