callbacks

package
Version: v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2023 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 IDs 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{}) uintptr

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

func (*Callbacks) Lookup

func (cb *Callbacks) Lookup(id uintptr) interface{}

Lookup returns a mapped callback/object given an ID.

func (*Callbacks) Remove

func (cb *Callbacks) Remove(id uintptr)

Remove a callback/object given it's ID.

Source Files

Jump to

Keyboard shortcuts

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