File: options.go

package info (click to toggle)
golang-github-mesos-mesos-go 0.0.6%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 11,724 kB
  • sloc: makefile: 163
file content (24 lines) | stat: -rw-r--r-- 475 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package executor

// A CallOpt is a functional option type for Calls.
type CallOpt func(*Call)

// With applies the given CallOpts to the receiving Call, returning it.
func (c *Call) With(opts ...CallOpt) *Call {
	for _, opt := range opts {
		opt(c)
	}
	return c
}

type CallOptions []CallOpt

// Copy returns a cloned copy of CallOptions
func (co CallOptions) Copy() CallOptions {
	if len(co) == 0 {
		return nil
	}
	x := make(CallOptions, len(co))
	copy(x, co)
	return x
}