cbuffer

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: Apache-2.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cbuffer provides a wrapper for a C/C++ buffer that can be used to transfer data in-between pjrt, xlabuilder and the user of the library.

It is used to feed data: literals for xlabuilder, and actual values for pjrt, and as a holder of the StableHLO program built by xlabuilder.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CBuffer

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

CBuffer is a generic wrapper to a C/C++ data, which is assumed to own the underlying data.

func New

func New(data unsafe.Pointer, size int, withStack bool) *CBuffer

New returns a CBuffer object to manage the C/C++ data.

If `withStack` is set to true, it also stores a stack of where it was created. This is used for debugging if it is garbage collected without being freed.

func NewFromString

func NewFromString(s string, withStack bool) *CBuffer

NewFromString returns a CBuffer that holds a copy of the given string.

Like a normal CBuffer, it needs to be freed.

func (*CBuffer) Bytes

func (b *CBuffer) Bytes() []byte

Bytes returns the buffer as a byte slice.

Ownership is not transferred: remember to free CBuffer afterward.

func (*CBuffer) Free

func (b *CBuffer) Free()

Free the underlying data. It sets the pointer to nil, so if it is called again, it is a no-op.

Jump to

Keyboard shortcuts

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