fn fmt()

in crates/zbus/src/match_rule/mod.rs [333:377]


    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        let mut first_component = true;
        if let Some(msg_type) = self.msg_type() {
            let type_str = match msg_type {
                Type::Error => "error",
                Type::MethodCall => "method_call",
                Type::MethodReturn => "method_return",
                Type::Signal => "signal",
            };
            write_match_rule_string_component(f, "type", type_str, &mut first_component)?;
        }
        if let Some(sender) = self.sender() {
            write_match_rule_string_component(f, "sender", sender, &mut first_component)?;
        }
        if let Some(interface) = self.interface() {
            write_match_rule_string_component(f, "interface", interface, &mut first_component)?;
        }
        if let Some(member) = self.member() {
            write_match_rule_string_component(f, "member", member, &mut first_component)?;
        }
        if let Some(destination) = self.destination() {
            write_match_rule_string_component(f, "destination", destination, &mut first_component)?;
        }
        if let Some(path_spec) = self.path_spec() {
            let (key, value) = match path_spec {
                PathSpec::Path(path) => ("path", path),
                PathSpec::PathNamespace(ns) => ("path_namespace", ns),
            };
            write_match_rule_string_component(f, key, value, &mut first_component)?;
        }
        for (i, arg) in self.args() {
            write_comma(f, &mut first_component)?;
            write!(f, "arg{i}='{arg}'")?;
        }
        for (i, arg_path) in self.arg_paths() {
            write_comma(f, &mut first_component)?;
            write!(f, "arg{i}path='{arg_path}'")?;
        }
        if let Some(arg0namespace) = self.arg0ns() {
            write_comma(f, &mut first_component)?;
            write!(f, "arg0namespace='{arg0namespace}'")?;
        }

        Ok(())
    }