intern

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: MPL-2.0, ISC Imports: 12 Imported by: 0

Documentation

Overview

Package intern implements value interning for Cgo sharing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Free deprecated

func Free(box *Box)

Free explicitly frees the box permanently. It must not be resurrected after this.

Deprecated: this function is no longer needed.

Types

type Box

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

Box is an opaque type holding extra data.

func Get

func Get(gobject unsafe.Pointer, take bool) *Box

Get gets the interned box for the given GObject C pointer. If the object is new or unknown, then a new box is made. If the intern box already exists for a given C pointer, then that box is weakly referenced and returned. The box will be reference-counted; the caller must use ShouldFree to unreference it.

func TryGet

func TryGet(gobject unsafe.Pointer) *Box

TryGet gets the Box associated with the GObject or nil if it's gone. The caller must not retain the Box pointer anywhere.

func (*Box) Closures added in v0.2.1

func (b *Box) Closures() *closure.Registry

Closures returns the closure registry for this Box.

func (*Box) GObject

func (b *Box) GObject() unsafe.Pointer

Object returns Box's C GObject pointer.

Jump to

Keyboard shortcuts

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