MCPcopy Create free account
hub / github.com/foxcpp/maddy / Callback

Method Callback

framework/config/map.go:631–643  ·  view source on GitHub ↗

Callback creates mapping that will call mapper() function for each directive with the specified name. No further processing is done. Directives with the specified name will not be returned by Process if AllowUnknown is used. It is intended to permit multiple independent values of directive with im

(name string, mapper func(*Map, Node) error)

Source from the content-addressed store, hash-verified

629// It is intended to permit multiple independent values of directive with
630// implementation-defined handling.
631func (m *Map) Callback(name string, mapper func(*Map, Node) error) {
632 if m.entries == nil {
633 m.entries = make(map[string]matcher)
634 }
635 if _, ok := m.entries[name]; ok {
636 panic("Map.Custom: duplicate matcher")
637 }
638
639 m.entries[name] = matcher{
640 name: name,
641 customCallback: mapper,
642 }
643}
644
645// Process maps variables from global configuration and block passed in NewMap.
646//

Callers 10

TestMap_CallbackFunction · 0.95
readListCfgMethod · 0.95
ConfigureMethod · 0.80
ConfigureMethod · 0.80
ConfigureMethod · 0.80
setConfigMethod · 0.80
ConfigureMethod · 0.80
ConfigureMethod · 0.80
ConfigureMethod · 0.80
ConfigureMethod · 0.80

Calls

no outgoing calls

Tested by 1

TestMap_CallbackFunction · 0.76