Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SafeChannel ¶
type SafeChannel[T any] struct { // contains filtered or unexported fields }
SafeChannel can send or be closed safely. Do not close the inner channel directly.
func NewSafeChannel ¶
func NewSafeChannel[T any]() *SafeChannel[T]
func (*SafeChannel[T]) OutCh ¶
func (c *SafeChannel[T]) OutCh() <-chan T
OutCh returns a native read-only channel.
func (*SafeChannel[T]) SafeClose ¶
func (c *SafeChannel[T]) SafeClose()
func (*SafeChannel[T]) SafeSend ¶
func (c *SafeChannel[T]) SafeSend(value T) (ok bool)
SafeSend sends given value safely which means there's no panic even if channel is closed. Return false if it has been closed.
Click to show internal directories.
Click to hide internal directories.