package closure
import "github.com/diamondburned/gotk4/pkg/core/closure"
Index ¶
- Constants
- type FuncStack
- func NewFuncStack(fn interface{}, frameSkip int) *FuncStack
- func NewIdleFuncStack(fn interface{}, frameSkip int) *FuncStack
- func (fs *FuncStack) IsValid() bool
- func (fs *FuncStack) Panicf(msgf string, v ...interface{})
- func (fs *FuncStack) TryRepanic()
- func (fs *FuncStack) ValidFrames() []uintptr
- func (fs *FuncStack) Value() reflect.Value
- type Registry
Constants ¶
const FrameSize = 3
FrameSize is the number of frames that FuncStack should trace back from.
Types ¶
type FuncStack ¶
type FuncStack struct { Func interface{} Frames [FrameSize]uintptr }
FuncStack wraps a function value and provides function frames containing the caller trace for debugging.
func NewFuncStack ¶
NewFuncStack creates a new FuncStack. The given frameSkip is added 2, meaning the first frame from 0 will start from the caller of NewFuncStack.
func NewIdleFuncStack ¶
NewIdleFuncStack works akin to NewFuncStack, but it also validates the given function type for the correct acceptable signatures for SourceFunc while also caching the checks.
func (*FuncStack) IsValid ¶
IsValid returns true if the given FuncStack is not a zero-value i.e. valid.
func (*FuncStack) Panicf ¶
Panicf panics with the given FuncStack printed to standard error.
func (*FuncStack) TryRepanic ¶
func (fs *FuncStack) TryRepanic()
TryRepanic attempts to recover a panic. If successful, it will re-panic with the trace, or none if there is already one.
func (*FuncStack) ValidFrames ¶
ValidFrames returns non-zero frames.
func (*FuncStack) Value ¶
Func returns the function as a reflect.Value.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry describes the local closure registry of each object.
func NewRegistry ¶
func NewRegistry() *Registry
NewRegistry creates an empty closure registry.
func (*Registry) Delete ¶
Delete deletes the given GClosure callback.
func (*Registry) Load ¶
Load loads the given GClosure's callback. Nil is returned if it's not found.
func (*Registry) Register ¶
Register registers the given GClosure callback.
Source Files ¶
- Version
- v0.3.1 (latest)
- Published
- Jul 31, 2024
- Platform
- linux/amd64
- Imports
- 7 packages
- Last checked
- 5 days ago –
Tools for package owners.