byteptr

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: MIT Imports: 1 Imported by: 2

README

Byteptr

Pointer is a solution to manipulate with bytes/strings (and their parts) without using pointers. It's a part of the reducing pointer policy.

Byteptr is similar of refrect.SliceHeader and refrecl.StringHeader structs, but provides extra methods to manipulate with data in raw memory.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Byteptr

type Byteptr = Pointer

Byteptr is a legacy alias of Pointer. Deprecated: use Pointer instead.

type Pointer added in v1.0.2

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

Pointer is a pointer-free representation of bytes/string types.

Similar to reflect.SliceHeader/reflect.StringHeader structs.

func Init added in v1.0.1

func Init(s []byte, offset, len int) Pointer

Init makes new ptr and set up with given params.

func InitStr added in v1.0.1

func InitStr(s string, offset, len int) Pointer

InitStr is a deprecated version of InitString. DEPRECATED: use InitString instead.

func InitString added in v1.0.1

func InitString(s string, offset, len int) Pointer

InitString makes new ptr and set up with given params.

func (*Pointer) Bytes added in v1.0.2

func (p *Pointer) Bytes() []byte

Bytes returns byte sub-slice using offset from previously take address with length len.

func (*Pointer) Init added in v1.0.2

func (p *Pointer) Init(s []byte, offset, len int) *Pointer

Init ptr with address of the byte array s and offset/length.

func (*Pointer) InitStr added in v1.0.2

func (p *Pointer) InitStr(s string, offset, len int) *Pointer

InitStr is a deprecated version of InitString. DEPRECATED: use InitString instead.

func (*Pointer) InitString added in v1.0.2

func (p *Pointer) InitString(s string, offset, len int) *Pointer

InitString ptr with address of the string s and offset/length.

func (*Pointer) Len added in v1.0.2

func (p *Pointer) Len() int

func (*Pointer) Offset added in v1.0.2

func (p *Pointer) Offset() int

Offset returns offset.

func (*Pointer) Reset added in v1.0.2

func (p *Pointer) Reset() *Pointer

Reset all fields.

Made to use with pools.

func (*Pointer) SetLen added in v1.0.2

func (p *Pointer) SetLen(len int) *Pointer

SetLen sets length of sub-slice.

func (*Pointer) SetOffset added in v1.0.2

func (p *Pointer) SetOffset(offset int) *Pointer

SetOffset sets offset from previously taken address.

func (*Pointer) String added in v1.0.2

func (p *Pointer) String() string

Get substring.

See Bytes().

func (*Pointer) TakeAddr added in v1.0.2

func (p *Pointer) TakeAddr(s []byte) *Pointer

TakeAddr is a deprecated version of TakeAddress. DEPRECATED: use TakeAddress instead.

func (*Pointer) TakeAddress added in v1.0.2

func (p *Pointer) TakeAddress(s []byte) *Pointer

TakeAddress takes address of underlying byte array of bytes s.

func (*Pointer) TakeStrAddr added in v1.0.2

func (p *Pointer) TakeStrAddr(s string) *Pointer

TakeStrAddr is a deprecated version of TakeStringAddress. DEPRECATED: use TakeStringAddress instead.

func (*Pointer) TakeStringAddress added in v1.0.2

func (p *Pointer) TakeStringAddress(s string) *Pointer

TakeStringAddress takes address of underlying byte array of string s.

Jump to

Keyboard shortcuts

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