package intern

import "github.com/diamondburned/gotk4/pkg/core/intern"

Package intern implements value interning for Cgo sharing.

Index

Functions

func Free

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

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.

Source Files

intern.go intern_export.go

Version
v0.3.1 (latest)
Published
Jul 31, 2024
Platform
linux/amd64
Imports
12 packages
Last checked
3 weeks ago

Tools for package owners.