-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcallbacker.go
40 lines (33 loc) · 1.12 KB
/
callbacker.go
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
29
30
31
32
33
34
35
36
37
38
39
40
/*
© 2024–present Harald Rudell <harald.rudell@gmail.com> (https://haraldrudell.github.io/haraldrudell/)
ISC License
*/
package parl
// Callbacker accepts asynchronously provided values
type Callbacker[T any] interface {
// Callback is an asynchronous return of a value
// - Callback typically needs to be thread-safe
Callback(value T)
}
// CallbackerErr accepts asynchronously provided values
// and can fail
type CallbackerErr[T any] interface {
// Callback is an asynchronous return of a value that can fail
// - Callback typically needs to be thread-safe
Callback(value T) (err error)
}
var NoCallbackerNoArg CallbackerNoArg
// CallbackerNoArg receives asynchronous event notifications
type CallbackerNoArg interface {
// Callback is an asynchronous event notifier
// - Callback typically needs to be thread-safe
Callback()
}
var NoCallbackerNoArgErr CallbackerNoArgErr
// CallbackerNoArgErr receives asynchronous event notifications
// and can fail
type CallbackerNoArgErr interface {
// Callback is an asynchronous event notifier that can fail
// - Callback typically needs to be thread-safe
Callback() (err error)
}