internal

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsupported   = errors.New("unsupported")
	ErrUnaddressable = errors.New("unaddressable")
	ErrOffset        = errors.New("offset")
)

Error to be used by sub packages. These will be overridden by the init function in fastbytes

Functions

func CheckOffsets added in v2.3.0

func CheckOffsets(start, end, length int) error

CheckOffsets checks if the given offsets are valid for a slice with the given length

func IsSafeSlice

func IsSafeSlice(t reflect.Type) bool

IsSafeSlice returns if the given type is a slice or array, with a element type that can be safely converted to bytes. Slices with the element type of uint8, uint16, uint32, uint64, int8, int16, int32, int64, float32 and float64 can be safely converted to bytes. uint, int, uintptr cannot safely be converted to bytes since their size is platform dependant.

func IsSafeSliceValue added in v2.3.0

func IsSafeSliceValue(v reflect.Value) bool

IsSafeSliceValue like IsSafeSlice but uses a reflect.Value instead. This function also checks if the given value is the zero value of reflect.Value.

Types

type Provider

type Provider interface {
	FromI8([]int8, []byte) int
	FromI16([]int16, []byte, bool) int
	FromI32([]int32, []byte, bool) int
	FromI64([]int64, []byte, bool) int
	FromU16([]uint16, []byte, bool) int
	FromU32([]uint32, []byte, bool) int
	FromU64([]uint64, []byte, bool) int
	FromF32([]float32, []byte, bool) int
	FromF64([]float64, []byte, bool) int
	ToI8([]uint8, []int8) int
	ToI16([]byte, []int16, bool) int
	ToI32([]byte, []int32, bool) int
	ToI64([]byte, []int64, bool) int
	ToU16([]byte, []uint16, bool) int
	ToU32([]byte, []uint32, bool) int
	ToU64([]byte, []uint64, bool) int
	ToF32([]byte, []float32, bool) int
	ToF64([]byte, []float64, bool) int
	FromSlice(interface{}, []byte, bool) (int, error)
	ToSlice([]byte, interface{}, bool) (int, error)
	FromValue(reflect.Value, []byte, bool) (int, error)
	ToValue([]byte, reflect.Value, bool) (int, error)
}

Provider a provider

Directories

Path Synopsis
asm

Jump to

Keyboard shortcuts

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