docs: add docstrings for walker/visitor handlers/rules

This commit is contained in:
James Houlahan
2020-08-18 10:38:27 +02:00
parent a2cf5374b9
commit 642666fa59
4 changed files with 18 additions and 4 deletions

View File

@ -41,6 +41,9 @@ type visitorRule struct {
fn VisitorRule
}
// RegisterRule defines what to do when visiting a part whose content type
// matches the given regular expression.
// If a part matches multiple rules, the one registered first will be used.
func (v *Visitor) RegisterRule(contentTypeRegex string, fn VisitorRule) *Visitor {
v.rules = append(v.rules, &visitorRule{
re: regexp.MustCompile(contentTypeRegex),