Documentation
¶
Index ¶
Constants ¶
const ( Uint8Bytes = 1 << iota // uint16Bytes the number of bytes in an uint16. Uint16Bytes // uint32Bytes the number of bytes in an uint32. Uint32Bytes // uint64Bytes the number of bytes in an uint64. Uint64Bytes )
Variables ¶
var ( ErrShort = errors.New("short") ErrUnsupported = errors.New("unsupported") ErrUnaddressable = errors.New("unaddressable") )
Error to be used by sub packages. These will be overridden by bytes
Functions ¶
func CanCopyFrom ¶
CanCopyFrom returns if src can be copied to dst This returns true if src can fit in dst and len(src)>0
func CanCopyTo ¶
CanCopyTo returns if src can be copied to dst This returns true if src can fit in dst and len(src)>0
func CanFitCopyFrom ¶
CanFitCopyFrom returns if dst is large enough to fit src if src has a element size of `size`
func CanFitCopyTo ¶
CanFitCopyTo returns if dst is large enough to fit src if dst has a element size of `size`
func IsSafeSlice ¶
IsSafeSlice returns if the given type is a slice or array, with a element type that can be safely converted to bytes. All signed and unsigned intergers except uint and int, and floats are considered to be safe types. uint and int are considered to be unsafe since their size is platform dependent.
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