pub struct MatchRule<'a> {
pub msg_type: Option<MessageType>,
pub sender: Option<BusName<'a>>,
pub strict_sender: bool,
pub path: Option<Path<'a>>,
pub path_is_namespace: bool,
pub interface: Option<Interface<'a>>,
pub member: Option<Member<'a>>,
pub eavesdrop: bool,
/* private fields */
}
Expand description
A “match rule”, that can match Messages on its headers.
A field set to “None” means no filter for that header, a field set to “Some(_)” must match exactly.
Fields
msg_type: Option<MessageType>
Match on message type (you typically want to do this)
sender: Option<BusName<'a>>
Match on message sender
strict_sender: bool
If false (the default), match if sender could possibly match, due to mismatch between unique names and taken bus names
path: Option<Path<'a>>
Match on message object path
path_is_namespace: bool
If true, will match all subpaths to the path as well as the path itself. Defaults to false.
interface: Option<Interface<'a>>
Match on message interface
member: Option<Member<'a>>
Match on message member (signal or method name)
eavesdrop: bool
If true, also receive messages not intended for us. Defaults to false.
Implementations
sourceimpl<'a> MatchRule<'a>
impl<'a> MatchRule<'a>
sourcepub fn matches(&self, msg: &Message) -> bool
pub fn matches(&self, msg: &Message) -> bool
Returns whether or not the message matches the rule.
sourcepub fn new_method_call() -> Self
pub fn new_method_call() -> Self
Create a new struct which matches every incoming method call message.
sourcepub fn new_signal<I: Into<Interface<'a>>, N: Into<Member<'a>>>(
intf: I,
name: N
) -> Self
pub fn new_signal<I: Into<Interface<'a>>, N: Into<Member<'a>>>(
intf: I,
name: N
) -> Self
Create a new struct which matches signals on the interface and member name.
sourcepub fn static_clone(&self) -> MatchRule<'static>
pub fn static_clone(&self) -> MatchRule<'static>
Returns a clone with no borrowed references
sourcepub fn with_eavesdrop(self) -> Self
pub fn with_eavesdrop(self) -> Self
Enables eavesdropping for the generated message. You probably want to use BecomeMonitor instead
sourcepub fn with_sender(self, sender: impl Into<BusName<'a>>) -> Self
pub fn with_sender(self, sender: impl Into<BusName<'a>>) -> Self
Sets the MatchRule to match on the message sender
sourcepub fn with_strict_sender(self, sender: impl Into<BusName<'a>>) -> Self
pub fn with_strict_sender(self, sender: impl Into<BusName<'a>>) -> Self
Sets the MatchRule to match on the message sender and be strict
sourcepub fn with_namespaced_path(self, path: impl Into<Path<'a>>) -> Self
pub fn with_namespaced_path(self, path: impl Into<Path<'a>>) -> Self
Sets the MatchRule to match on the message path and treat it as a namespace
sourcepub fn with_path(self, path: impl Into<Path<'a>>) -> Self
pub fn with_path(self, path: impl Into<Path<'a>>) -> Self
Sets the MatchRule to match on the message path
sourcepub fn with_interface(self, intf: impl Into<Interface<'a>>) -> Self
pub fn with_interface(self, intf: impl Into<Interface<'a>>) -> Self
Sets the MatchRule to match on the message interface
sourcepub fn with_member(self, member: impl Into<Member<'a>>) -> Self
pub fn with_member(self, member: impl Into<Member<'a>>) -> Self
Sets the MatchRule to match on the message member
sourcepub fn with_type(self, ty: MessageType) -> Self
pub fn with_type(self, ty: MessageType) -> Self
Sets the MatchRule to match on the message type. This will usually be "signal"