github.com/searKing/golang/go@v1.2.74/net/resolver/resolvedone_options.go (about) 1 // Code generated by "go-option -type resolveDone"; DO NOT EDIT. 2 // Install go-option by "go get install github.com/searKing/golang/tools/go-option" 3 4 package resolver 5 6 // A ResolveDoneOption sets options. 7 type ResolveDoneOption interface { 8 apply(*resolveDone) 9 } 10 11 // EmptyResolveDoneOption does not alter the configuration. It can be embedded 12 // in another structure to build custom options. 13 // 14 // This API is EXPERIMENTAL. 15 type EmptyResolveDoneOption struct{} 16 17 func (EmptyResolveDoneOption) apply(*resolveDone) {} 18 19 // ResolveDoneOptionFunc wraps a function that modifies resolveDone into an 20 // implementation of the ResolveDoneOption interface. 21 type ResolveDoneOptionFunc func(*resolveDone) 22 23 func (f ResolveDoneOptionFunc) apply(do *resolveDone) { 24 f(do) 25 } 26 27 // ApplyOptions call apply() for all options one by one 28 func (o *resolveDone) ApplyOptions(options ...ResolveDoneOption) *resolveDone { 29 for _, opt := range options { 30 if opt == nil { 31 continue 32 } 33 opt.apply(o) 34 } 35 return o 36 } 37 38 // sample code for option, default for nothing to change 39 func _ResolveDoneOptionWithDefault() ResolveDoneOption { 40 return ResolveDoneOptionFunc(func(*resolveDone) { 41 // nothing to change 42 }) 43 }