@@ -49,6 +49,7 @@ import (
4949 "errors"
5050 "fmt"
5151 "io"
52+ "iter"
5253 "os/exec"
5354 "runtime"
5455 "slices"
@@ -1036,9 +1037,9 @@ func (t *table) updatesApplied() {
10361037 t .MustFlush = false
10371038}
10381039
1039- /* Can't make text/template range over this, not sure why .. .
1040+ // Rules returns an iterator that yields the chain's rules in order .
10401041func (c * chain ) Rules () iter.Seq [string ] {
1041- groups := make([]int , 0, len(c.ruleGroups))
1042+ groups := make ([]RuleGroup , 0 , len (c .ruleGroups ))
10421043 for group := range c .ruleGroups {
10431044 groups = append (groups , group )
10441045 }
@@ -1053,23 +1054,6 @@ func (c *chain) Rules() iter.Seq[string] {
10531054 }
10541055 }
10551056}
1056- */
1057-
1058- // Rules returns the chain's rules, in order.
1059- func (c * chain ) Rules () []string {
1060- groups := make ([]RuleGroup , 0 , len (c .ruleGroups ))
1061- nRules := 0
1062- for group := range c .ruleGroups {
1063- groups = append (groups , group )
1064- nRules += len (c .ruleGroups [group ])
1065- }
1066- slices .Sort (groups )
1067- rules := make ([]string , 0 , nRules )
1068- for _ , group := range groups {
1069- rules = append (rules , c .ruleGroups [group ]... )
1070- }
1071- return rules
1072- }
10731057
10741058func parseTemplate () error {
10751059 var err error
0 commit comments