callbacks

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callbacks

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

Callbacks provides a tracker for data that is to be passed between Go and C callback functions. The Go callback/object may not be passed by a pointer to C code and so instead integer indexes into an internal map are used. Typically the item being added will either be a callback function or a data structure containing a callback function. It is up to the caller to control and validate what "callbacks" get used.

func New

func New() *Callbacks

New returns a new callbacks tracker.

func (*Callbacks) Add

func (cb *Callbacks) Add(v interface{}) int

Add a callback/object to the tracker and return a new index for the object.

func (*Callbacks) Lookup

func (cb *Callbacks) Lookup(index int) interface{}

Lookup returns a mapped callback/object given an index.

func (*Callbacks) Remove

func (cb *Callbacks) Remove(index int)

Remove a callback/object given it's index.

Jump to

Keyboard shortcuts

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