Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Defer ¶ added in v0.4.0
func Defer(f func()) func(yield func() bool)
Defer returns an iterator that will run f after yielding once. Used for block level defer. ```
func f(m *sync.Mutex) { m.Lock() for range Defer(func() { m.Unlock() }) { // do something while m locked } // m is unlocked here }
```
Types ¶
type Iterator ¶ added in v0.3.0
type Iterator[V any] struct { // contains filtered or unexported fields }
func Single ¶ added in v0.3.0
Single converts a possible multi-use iterator into a single-use resumable iterator. Must `defer it.Stop()` or fully consume the iterator, otherwise you have a goroutine (coroutine created by iter.Pull) leak. See https://pkg.go.dev/iter#hdr-Single_Use_Iterators. Goroutine leak detector: https://github.com/uber-go/goleak
Click to show internal directories.
Click to hide internal directories.