MCPcopy
hub / github.com/rs/zerolog / Next

Method Next

diode/internal/diodes/waiter.go:63–79  ·  view source on GitHub ↗

Next returns the next data point on the wrapped diode. If there is not any new data, it will Wait for set to be called or the context to be done. If the context is done, then nil will be returned.

()

Source from the content-addressed store, hash-verified

61// new data, it will Wait for set to be called or the context to be done.
62// If the context is done, then nil will be returned.
63func (w *Waiter) Next() GenericDataType {
64 w.mu.Lock()
65 defer w.mu.Unlock()
66
67 for {
68 data, ok := w.Diode.TryNext()
69 if !ok {
70 if w.isDone() {
71 return nil
72 }
73
74 w.c.Wait()
75 continue
76 }
77 return data
78 }
79}
80
81func (w *Waiter) isDone() bool {
82 select {

Callers

nothing calls this directly

Calls 2

isDoneMethod · 0.95
TryNextMethod · 0.65

Tested by

no test coverage detected