File: interface.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 (28 lines) | stat: -rw-r--r-- 511 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package callback

import (
	"fmt"
)

type Unsupported struct {
	Callback Interface
}

func (uc *Unsupported) Error() string {
	return fmt.Sprintf("Unsupported callback <%T>: %v", uc.Callback, uc.Callback)
}

type Interface interface {
	// marker interface
}

type Handler interface {
	// may return an Unsupported error on failure
	Handle(callbacks ...Interface) error
}

type HandlerFunc func(callbacks ...Interface) error

func (f HandlerFunc) Handle(callbacks ...Interface) error {
	return f(callbacks...)
}