Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Closable ¶
type Closable[T any] interface { // Close pushes final values (if any) and marks the flow as closed. // After Close is called, all channels produced by Listenable.Listen will close after emitting the final values. // Once closed, Resettable.Reset will no longer have any effect. // Close can be safely called multiple times, but only the first invocation will push values and close the flow. Close(...T) }
type Empty ¶
type Empty[T any] struct{}
Empty represents a Flow that immediately closes without emitting any values.
type Flow ¶
type Flow[T any] interface { Listenable[T] Pushable[T] Closable[T] Resettable[T] }
Flow is an interface that combines Listenable, Pushable, Closable, and Resettable.
type Listenable ¶
type Listenable[T any] interface { // Listen returns a channel that emits values pushed into the flow. // The channel closes when either the Closable.Close method is called or the provided context is cancelled. // The values received by the channel will be in the same order they were pushed. Listen(ctx context.Context) <-chan T }
type Never ¶
type Never[T any] struct{}
Never represents a Flow that never emits any value and closes only when the Listen context is cancelled.
type Pushable ¶
type Pushable[T any] interface { // Push allows multiple values to be pushed into the flow. // This operation is thread-safe and does not block the caller. Push(...T) }
type Repeater ¶
type Repeater[T any] struct { // contains filtered or unexported fields }
Repeater is a Flow implementation that repeats values until reset.
func (*Repeater[T]) Close ¶
func (r *Repeater[T]) Close(value ...T)
Close finalizes the flow by pushing the provided values and marking it as closed.
func (*Repeater[T]) Listen ¶
Listen returns a channel that emits values starting from the current reference node. The channel will close when the context is canceled or the flow is closed.
type Resettable ¶
type Resettable[T any] interface { // Reset clears the flow and pushes new values into it. // If the flow is already closed (via Closable.Close), Reset will have no effect. Reset(...T) }
type Stream ¶
type Stream[T any] struct { // contains filtered or unexported fields }
Stream is a Flow implementation that emits ordered values until closed.
func (*Stream[T]) Close ¶
func (s *Stream[T]) Close(value ...T)
Close finalizes the flow by pushing the provided values and marking it as closed.