Struct zbus::MatchRuleBuilder
source · pub struct MatchRuleBuilder<'m>(/* private fields */);
Expand description
Builder for MatchRule
.
This is created by MatchRule::builder
.
Implementations§
source§impl<'m> MatchRuleBuilder<'m>
impl<'m> MatchRuleBuilder<'m>
sourcepub fn msg_type(self, msg_type: MessageType) -> Self
pub fn msg_type(self, msg_type: MessageType) -> Self
Set the message type.
sourcepub fn path<P>(self, path: P) -> Result<Self>
pub fn path<P>(self, path: P) -> Result<Self>
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>
pub fn path_namespace<P>(self, path_namespace: P) -> Result<Self>
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>
pub fn destination<B>(self, destination: B) -> Result<Self>
Set the destination.
sourcepub fn add_arg<S>(self, arg: S) -> Result<Self>
pub fn add_arg<S>(self, arg: S) -> Result<Self>
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>
pub fn add_arg_path<P>(self, arg_path: P) -> Result<Self>
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>
pub fn arg_path<P>(self, idx: u8, arg_path: P) -> Result<Self>
Add a path argument of a specified index.
§Errors
Error::InvalidMatchRule
if idx
is greater than 64.
sourcepub fn arg0namespace<I>(self, namespace: I) -> Result<Self>
👎Deprecated: use arg0ns instead
pub fn arg0namespace<I>(self, namespace: I) -> Result<Self>
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>
pub fn arg0ns<S>(self, namespace: S) -> Result<Self>
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();