async

package
v2.1.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2021 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Overview

Package async provides unbounded channel data structures that are designed for caching unlimited number of a concrete type. For better performance, a given type should have a smaller or euqal size of 16-bit.

To support a new type, one may add the required data in the gen.go, for instances:

types := map[string]data{
	"fyne_canvasobject.go": data{
		Type: "fyne.CanvasObject",
		Name: "CanvasObject",
		Imports: `import "fyne.io/fyne/v2"`,
	},
	"func.go": data{
		Type:    "func()",
		Name:    "Func",
		Imports: "",
	},
}

then run: `go generate ./...` to generate more desired unbounded channels.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type UnboundedCanvasObjectChan

type UnboundedCanvasObjectChan struct {
	// contains filtered or unexported fields
}

UnboundedCanvasObjectChan is a channel with an unbounded buffer for caching CanvasObject objects.

Delicate dance: One must aware that an unbounded channel may lead to OOM when the consuming speed of the buffer is lower than the producing speed constantly. However, such a channel may be fairly used for event delivering if the consumer of the channel consumes the incoming forever. Especially, rendering and even processing tasks.

func NewUnboundedCanvasObjectChan

func NewUnboundedCanvasObjectChan() *UnboundedCanvasObjectChan

NewUnboundedCanvasObjectChan returns a unbounded channel with unlimited capacity.

func (*UnboundedCanvasObjectChan) In

func (ch *UnboundedCanvasObjectChan) In() chan<- fyne.CanvasObject

In returns a send-only channel that can be used to send values to the channel.

func (*UnboundedCanvasObjectChan) Out

func (ch *UnboundedCanvasObjectChan) Out() <-chan fyne.CanvasObject

Out returns a receive-only channel that can be used to receive values from the channel.

type UnboundedFuncChan

type UnboundedFuncChan struct {
	// contains filtered or unexported fields
}

UnboundedFuncChan is a channel with an unbounded buffer for caching Func objects.

Delicate dance: One must aware that an unbounded channel may lead to OOM when the consuming speed of the buffer is lower than the producing speed constantly. However, such a channel may be fairly used for event delivering if the consumer of the channel consumes the incoming forever. Especially, rendering and even processing tasks.

func NewUnboundedFuncChan

func NewUnboundedFuncChan() *UnboundedFuncChan

NewUnboundedFuncChan returns a unbounded channel with unlimited capacity.

func (*UnboundedFuncChan) In

func (ch *UnboundedFuncChan) In() chan<- func()

In returns a send-only channel that can be used to send values to the channel.

func (*UnboundedFuncChan) Out

func (ch *UnboundedFuncChan) Out() <-chan func()

Out returns a receive-only channel that can be used to receive values from the channel.

Jump to

Keyboard shortcuts

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