Struct zbus::MatchRuleBuilder
source · pub struct MatchRuleBuilder<'m>(_);Expand description
Builder for MatchRule.
This is created by MatchRule::builder.
Implementations§
source§impl<'m> MatchRuleBuilder<'m>
impl<'m> MatchRuleBuilder<'m>
sourcepub fn sender<B>(self, sender: B) -> Result<Self>where
B: TryInto<BusName<'m>>,
B::Error: Into<Error>,
pub fn sender<B>(self, sender: B) -> Result<Self>where B: TryInto<BusName<'m>>, B::Error: Into<Error>,
Set the sender.
sourcepub fn msg_type(self, msg_type: MessageType) -> Self
pub fn msg_type(self, msg_type: MessageType) -> Self
Set the message type.
sourcepub fn interface<I>(self, interface: I) -> Result<Self>where
I: TryInto<InterfaceName<'m>>,
I::Error: Into<Error>,
pub fn interface<I>(self, interface: I) -> Result<Self>where I: TryInto<InterfaceName<'m>>, I::Error: Into<Error>,
Set the interface.
sourcepub fn member<M>(self, member: M) -> Result<Self>where
M: TryInto<MemberName<'m>>,
M::Error: Into<Error>,
pub fn member<M>(self, member: M) -> Result<Self>where M: TryInto<MemberName<'m>>, M::Error: Into<Error>,
Set the member.
sourcepub fn path<P>(self, path: P) -> Result<Self>where
P: TryInto<ObjectPath<'m>>,
P::Error: Into<Error>,
pub fn path<P>(self, path: P) -> Result<Self>where P: TryInto<ObjectPath<'m>>, P::Error: Into<Error>,
Set the path.
Note: Since both a path and a path namespace are not allowed to appear in a match rule at the same time, this overrides any path namespace previously set.
sourcepub fn path_namespace<P>(self, path_namespace: P) -> Result<Self>where
P: TryInto<ObjectPath<'m>>,
P::Error: Into<Error>,
pub fn path_namespace<P>(self, path_namespace: P) -> Result<Self>where P: TryInto<ObjectPath<'m>>, P::Error: Into<Error>,
Set the path namespace.
Note: Since both a path and a path namespace are not allowed to appear in a match rule at the same time, this overrides any path previously set.
sourcepub fn destination<B>(self, destination: B) -> Result<Self>where
B: TryInto<UniqueName<'m>>,
B::Error: Into<Error>,
pub fn destination<B>(self, destination: B) -> Result<Self>where B: TryInto<UniqueName<'m>>, B::Error: Into<Error>,
Set the destination.
sourcepub fn add_arg<S>(self, arg: S) -> Result<Self>where
S: Into<Str<'m>>,
pub fn add_arg<S>(self, arg: S) -> Result<Self>where S: Into<Str<'m>>,
Append an arguments.
Use this in instead of MatchRuleBuilder::arg if you want to sequentially add args.
Errors
Error::InvalidMatchRule on attempt to add the 65th argument.
sourcepub fn add_arg_path<P>(self, arg_path: P) -> Result<Self>where
P: TryInto<ObjectPath<'m>>,
P::Error: Into<Error>,
pub fn add_arg_path<P>(self, arg_path: P) -> Result<Self>where P: TryInto<ObjectPath<'m>>, P::Error: Into<Error>,
Append a path argument.
Use this in instead of MatchRuleBuilder::arg_path if you want to sequentially add args.
Errors
Error::InvalidMatchRule on attempt to add the 65th path argument.
sourcepub fn arg_path<P>(self, idx: u8, arg_path: P) -> Result<Self>where
P: TryInto<ObjectPath<'m>>,
P::Error: Into<Error>,
pub fn arg_path<P>(self, idx: u8, arg_path: P) -> Result<Self>where P: TryInto<ObjectPath<'m>>, P::Error: Into<Error>,
sourcepub fn arg0namespace<I>(self, namespace: I) -> Result<Self>where
I: TryInto<InterfaceName<'m>>,
I::Error: Into<Error>,
👎Deprecated: use arg0ns instead
pub fn arg0namespace<I>(self, namespace: I) -> Result<Self>where I: TryInto<InterfaceName<'m>>, I::Error: Into<Error>,
Set 0th argument’s namespace.
This function is deprecated because the choice of InterfaceName was too restrictive.
sourcepub fn arg0ns<S>(self, namespace: S) -> Result<Self>where
S: Into<Str<'m>>,
pub fn arg0ns<S>(self, namespace: S) -> Result<Self>where S: Into<Str<'m>>,
Set 0th argument’s namespace.
The namespace be a valid bus name or a valid element of a bus name. For more information, see the spec.
Examples
// Valid namespaces
MatchRule::builder().arg0ns("org.mpris.MediaPlayer2").unwrap();
MatchRule::builder().arg0ns("org").unwrap();
MatchRule::builder().arg0ns(":org").unwrap();
MatchRule::builder().arg0ns(":1org").unwrap();
// Invalid namespaces
MatchRule::builder().arg0ns("org.").unwrap_err();
MatchRule::builder().arg0ns(".org").unwrap_err();
MatchRule::builder().arg0ns("1org").unwrap_err();
MatchRule::builder().arg0ns(".").unwrap_err();
MatchRule::builder().arg0ns("org..freedesktop").unwrap_err();