spec:
package c
func ClosureData[ClosureT any](closure ClosureT) Pointer
func GoClosure[ClosureT any](data Pointer) (closure ClosureT)
example:
// VisitChildren visits the children of a particular cursor, invoking the given
// visitor function for each child cursor. The traversal may be recursive,
// depending on the return value of the visitor function.
func VisitChildren(root Cursor, fn func(cur, parent Cursor) ChildVisitResult) uint {
return uint(clang.VisitChildren(
root, func(cur, parent Cursor, param clang.ClientData) ChildVisitResult {
return c.GoClosure[func(cur, parent Cursor) ChildVisitResult](param)(cur, parent)
}, c.ClosureData(fn)))
}
spec:
example: