diff --git a/pkg/contracts/contracts.go b/pkg/contracts/contracts.go index 25513aa7..51594144 100644 --- a/pkg/contracts/contracts.go +++ b/pkg/contracts/contracts.go @@ -66,6 +66,15 @@ type Waiter interface { Wait() error // Wait waits for execution to complete. } +// The WaiterFunc type is an adapter to allow the use of ordinary functions as Waiter. +// If f is a function with the appropriate signature, WaiterFunc(f) is a Waiter that calls f. +type WaiterFunc func() error + +// Wait implements the Waiter interface. +func (f WaiterFunc) Wait() error { + return f() +} + // Initer implements the Init method, // which initializes the object in addition to zeroing. type Initer interface {