Struct async_rustbus::MatchRule
source · pub struct MatchRule {
pub sender: Option<Arc<str>>,
pub path: Option<Arc<str>>,
pub path_namespace: Option<Arc<str>>,
pub interface: Option<Arc<str>>,
pub member: Option<Arc<str>>,
/* private fields */
}
Expand description
Represents a match for incoming signals.
Signals match a MatchRule
if they match every field.
When one of the fields is None
it is equivelent to a wildcard for that field,
causing that field to be matching for every signal.
MatchRule’s are ordered by their specificity.
If one MatchRule
is ‘less than’ another, then it is more specific than the other one.
See the Ord
impl for details.
Fields§
§sender: Option<Arc<str>>
Checks against the sender of the signal.
path: Option<Arc<str>>
Matches against the object path of the signal requiring an exact match (no children).
path
and path_namespace
cannot be used simultanously.
path_namespace: Option<Arc<str>>
Matches against the object path of the signal.
It accepts an exact match, or a child of path_namespace
.
path
and path_namespace
cannot be used simultanously.
interface: Option<Arc<str>>
Matches against the interface of the signal.
member: Option<Arc<str>>
Matches against the signal member.
Implementations§
source§impl MatchRule
impl MatchRule
pub fn new() -> Self
pub fn sender<S: Into<String>>(&mut self, sender: S) -> &mut Self
pub fn path<S: Into<String>>(&mut self, path: S) -> &mut Self
pub fn path_namespace<S: Into<String>>( &mut self, path_namespace: S ) -> &mut Self
pub fn interface<S: Into<String>>(&mut self, interface: S) -> &mut Self
pub fn member<S: Into<String>>(&mut self, member: S) -> &mut Self
pub fn is_empty(&self) -> bool
sourcepub fn matches(&self, msg: &MarshalledMessage) -> bool
pub fn matches(&self, msg: &MarshalledMessage) -> bool
Returns true
if the message is a signal and matches the rule.
sourcepub fn match_string(&self) -> String
pub fn match_string(&self) -> String
Returns the org.freedesktop.DBus.AddMatch
match rule string.
Trait Implementations§
source§impl Ord for MatchRule
impl Ord for MatchRule
MatchRule
s are ordered by their specificity.
If one match rule is ‘less than’ another then it is more specific than the other.
When evaluating specificity the following steps are taken:
- If one rule has
Some
sender
and the otherNone
then, the former is less than the latter. Otherwise continue to the next step. - If one rule has
Some
path
and the otherNone
then, the former is less than the latter. Otherwise continue to the next step. - If one rule has
Some
path_namespace
and the otherNone
then, the former is less than the latter. Otherwise continue to the next step. - If both rules have
Some
path_namespace
and one is a subset of the other than the former is less than the latter. Otherwise continue to the next step. - If one rule has
Some
interface
and the otherNone
then, the former is less than the latter. Otherwise continue to the next step. - If one rule has
Some
member
and the otherNone
then, the former is less than the latter. Otherwise continue to the next step. - Compare
sender
field. If not equal return theOrdering
, otherwise continue to the next step. - Compare
path
field. If not equal return theOrdering
, otherwise continue to the next step. - Compare
path_namespace
field. If not equal return theOrdering
, otherwise continue to the next step. - Compare
interface
field. If not equal return theOrdering
, otherwise continue to the next step. - Compare
member
field, and return the result.
source§impl PartialEq<MatchRule> for MatchRule
impl PartialEq<MatchRule> for MatchRule
source§impl PartialOrd<MatchRule> for MatchRule
impl PartialOrd<MatchRule> for MatchRule
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more