util

package
v0.2.3-rc5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BufferedRead

func BufferedRead(buffer *bytes.Buffer, output []byte, reader ReadFunc) (int, error)

func ErrIsClose added in v0.2.3

func ErrIsClose(err error) bool

func ReadPacket

func ReadPacket(conn net.Conn) ([]byte, error)

func WritePacket

func WritePacket(conn net.Conn, payload []byte) error

Types

type Future added in v0.2.3

type Future[T any] interface {
	IsFinished() bool
	Wait(timeout time.Duration) (*T, bool)
	Chan() chan T
}

type Promise added in v0.2.3

type Promise[T any] struct {
	// contains filtered or unexported fields
}

func NewPromise added in v0.2.3

func NewPromise[T any]() *Promise[T]

func (*Promise[T]) Chan added in v0.2.3

func (p *Promise[T]) Chan() chan T

func (*Promise[T]) Complete added in v0.2.3

func (p *Promise[T]) Complete(value T)

func (*Promise[T]) Future added in v0.2.3

func (p *Promise[T]) Future() Future[T]

func (*Promise[T]) IsFinished added in v0.2.3

func (p *Promise[T]) IsFinished() bool

func (*Promise[T]) Reset added in v0.2.3

func (p *Promise[T]) Reset()

func (*Promise[T]) Wait added in v0.2.3

func (p *Promise[T]) Wait(timeout time.Duration) (*T, bool)

type ReadFunc

type ReadFunc func() ([]byte, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL