Documentation
¶
Overview ¶
Package xcast provides utilities for lossless type conversions.
Example ¶
package main
import (
"fmt"
"github.com/ctx42/convert/pkg/xcast"
)
func main() {
// Successful cast.
ui8, err := xcast.IntToUint8(42)
fmt.Printf("xcast.IntToUint8 output: %[1]T(%[1]d) error: %v\n", ui8, err)
// Value too big for uint8.
ui8, err = xcast.IntToUint8(420)
fmt.Printf("xcast.IntToUint8 output: %[1]T(%[1]d) error: %v\n", ui8, err)
// Unsafe cast.
f32, err := xcast.IntToFloat32(xcast.Float32SafeIntMax + 1)
fmt.Printf("xcast.IntToUint8 output: %[1]T(%[1]g) error: %v\n", f32, err)
}
Output: xcast.IntToUint8 output: uint8(42) error: <nil> xcast.IntToUint8 output: uint8(0) error: int value out of range for uint8 xcast.IntToUint8 output: float32(0) error: int value out of safe range for float32
Index ¶
- Constants
- Variables
- func BoolToBool(value bool) (bool, error)
- func ByteToByte(value byte) (byte, error)
- func ByteToFloat32(value byte) (float32, error)
- func ByteToFloat64(value byte) (float64, error)
- func ByteToInt(value byte) (int, error)
- func ByteToInt8(value byte) (int8, error)
- func ByteToInt16(value byte) (int16, error)
- func ByteToInt32(value byte) (int32, error)
- func ByteToInt64(value byte) (int64, error)
- func ByteToRune(value byte) (rune, error)
- func ByteToUint(value byte) (uint, error)
- func ByteToUint8(value byte) (uint8, error)
- func ByteToUint16(value byte) (uint16, error)
- func ByteToUint32(value byte) (uint32, error)
- func ByteToUint64(value byte) (uint64, error)
- func ByteToUintptr(value byte) (uintptr, error)
- func Float32ToByte(value float32) (byte, error)
- func Float32ToFloat32(value float32) (float32, error)
- func Float32ToFloat64(value float32) (float64, error)
- func Float32ToInt(value float32) (int, error)
- func Float32ToInt8(value float32) (int8, error)
- func Float32ToInt16(value float32) (int16, error)
- func Float32ToInt32(value float32) (int32, error)
- func Float32ToInt64(value float32) (int64, error)
- func Float32ToRune(value float32) (rune, error)
- func Float32ToUint(value float32) (uint, error)
- func Float32ToUint8(value float32) (uint8, error)
- func Float32ToUint16(value float32) (uint16, error)
- func Float32ToUint32(value float32) (uint32, error)
- func Float32ToUint64(value float32) (uint64, error)
- func Float32ToUintptr(value float32) (uintptr, error)
- func Float64ToByte(value float64) (byte, error)
- func Float64ToFloat32(value float64) (float32, error)
- func Float64ToFloat64(value float64) (float64, error)
- func Float64ToInt(value float64) (int, error)
- func Float64ToInt8(value float64) (int8, error)
- func Float64ToInt16(value float64) (int16, error)
- func Float64ToInt32(value float64) (int32, error)
- func Float64ToInt64(value float64) (int64, error)
- func Float64ToRune(value float64) (rune, error)
- func Float64ToUint(value float64) (uint, error)
- func Float64ToUint8(value float64) (uint8, error)
- func Float64ToUint16(value float64) (uint16, error)
- func Float64ToUint32(value float64) (uint32, error)
- func Float64ToUint64(value float64) (uint64, error)
- func Float64ToUintptr(value float64) (uintptr, error)
- func Int8ToByte(value int8) (byte, error)
- func Int8ToFloat32(value int8) (float32, error)
- func Int8ToFloat64(value int8) (float64, error)
- func Int8ToInt(value int8) (int, error)
- func Int8ToInt8(value int8) (int8, error)
- func Int8ToInt16(value int8) (int16, error)
- func Int8ToInt32(value int8) (int32, error)
- func Int8ToInt64(value int8) (int64, error)
- func Int8ToRune(value int8) (rune, error)
- func Int8ToUint(value int8) (uint, error)
- func Int8ToUint8(value int8) (uint8, error)
- func Int8ToUint16(value int8) (uint16, error)
- func Int8ToUint32(value int8) (uint32, error)
- func Int8ToUint64(value int8) (uint64, error)
- func Int8ToUintptr(value int8) (uintptr, error)
- func Int16ToByte(value int16) (byte, error)
- func Int16ToFloat32(value int16) (float32, error)
- func Int16ToFloat64(value int16) (float64, error)
- func Int16ToInt(value int16) (int, error)
- func Int16ToInt8(value int16) (int8, error)
- func Int16ToInt16(value int16) (int16, error)
- func Int16ToInt32(value int16) (int32, error)
- func Int16ToInt64(value int16) (int64, error)
- func Int16ToRune(value int16) (rune, error)
- func Int16ToUint(value int16) (uint, error)
- func Int16ToUint8(value int16) (uint8, error)
- func Int16ToUint16(value int16) (uint16, error)
- func Int16ToUint32(value int16) (uint32, error)
- func Int16ToUint64(value int16) (uint64, error)
- func Int16ToUintptr(value int16) (uintptr, error)
- func Int32ToByte(value int32) (byte, error)
- func Int32ToFloat32(value int32) (float32, error)
- func Int32ToFloat64(value int32) (float64, error)
- func Int32ToInt(value int32) (int, error)
- func Int32ToInt8(value int32) (int8, error)
- func Int32ToInt16(value int32) (int16, error)
- func Int32ToInt32(value int32) (int32, error)
- func Int32ToInt64(value int32) (int64, error)
- func Int32ToRune(value int32) (rune, error)
- func Int32ToUint(value int32) (uint, error)
- func Int32ToUint8(value int32) (uint8, error)
- func Int32ToUint16(value int32) (uint16, error)
- func Int32ToUint32(value int32) (uint32, error)
- func Int32ToUint64(value int32) (uint64, error)
- func Int32ToUintptr(value int32) (uintptr, error)
- func Int64ToByte(value int64) (byte, error)
- func Int64ToFloat32(value int64) (float32, error)
- func Int64ToFloat64(value int64) (float64, error)
- func Int64ToInt(value int64) (int, error)
- func Int64ToInt8(value int64) (int8, error)
- func Int64ToInt16(value int64) (int16, error)
- func Int64ToInt32(value int64) (int32, error)
- func Int64ToInt64(value int64) (int64, error)
- func Int64ToRune(value int64) (rune, error)
- func Int64ToUint(value int64) (uint, error)
- func Int64ToUint8(value int64) (uint8, error)
- func Int64ToUint16(value int64) (uint16, error)
- func Int64ToUint32(value int64) (uint32, error)
- func Int64ToUint64(value int64) (uint64, error)
- func Int64ToUintptr(value int64) (uintptr, error)
- func IntToByte(value int) (byte, error)
- func IntToFloat32(value int) (float32, error)
- func IntToFloat64(value int) (float64, error)
- func IntToInt(value int) (int, error)
- func IntToInt8(value int) (int8, error)
- func IntToInt16(value int) (int16, error)
- func IntToInt32(value int) (int32, error)
- func IntToInt64(value int) (int64, error)
- func IntToRune(value int) (rune, error)
- func IntToUint(value int) (uint, error)
- func IntToUint8(value int) (uint8, error)
- func IntToUint16(value int) (uint16, error)
- func IntToUint32(value int) (uint32, error)
- func IntToUint64(value int) (uint64, error)
- func IntToUintptr(value int) (uintptr, error)
- func RuneToByte(value rune) (byte, error)
- func RuneToFloat32(value rune) (float32, error)
- func RuneToFloat64(value rune) (float64, error)
- func RuneToInt(value rune) (int, error)
- func RuneToInt8(value rune) (int8, error)
- func RuneToInt16(value rune) (int16, error)
- func RuneToInt32(value rune) (int32, error)
- func RuneToInt64(value rune) (int64, error)
- func RuneToRune(value rune) (rune, error)
- func RuneToUint(value rune) (uint, error)
- func RuneToUint8(value rune) (uint8, error)
- func RuneToUint16(value rune) (uint16, error)
- func RuneToUint32(value rune) (uint32, error)
- func RuneToUint64(value rune) (uint64, error)
- func RuneToUintptr(value rune) (uintptr, error)
- func StringToDuration(value string) (time.Duration, error)
- func StringToString(value string) (string, error)
- func StringToTime(format string) func(value string) (time.Time, error)
- func SupportedTypes() []reflect.Type
- func Uint8ToByte(value uint8) (byte, error)
- func Uint8ToFloat32(value uint8) (float32, error)
- func Uint8ToFloat64(value uint8) (float64, error)
- func Uint8ToInt(value uint8) (int, error)
- func Uint8ToInt8(value uint8) (int8, error)
- func Uint8ToInt16(value uint8) (int16, error)
- func Uint8ToInt32(value uint8) (int32, error)
- func Uint8ToInt64(value uint8) (int64, error)
- func Uint8ToRune(value uint8) (rune, error)
- func Uint8ToUint(value uint8) (uint, error)
- func Uint8ToUint8(value uint8) (uint8, error)
- func Uint8ToUint16(value uint8) (uint16, error)
- func Uint8ToUint32(value uint8) (uint32, error)
- func Uint8ToUint64(value uint8) (uint64, error)
- func Uint8ToUintptr(value uint8) (uintptr, error)
- func Uint16ToByte(value uint16) (byte, error)
- func Uint16ToFloat32(value uint16) (float32, error)
- func Uint16ToFloat64(value uint16) (float64, error)
- func Uint16ToInt(value uint16) (int, error)
- func Uint16ToInt8(value uint16) (int8, error)
- func Uint16ToInt16(value uint16) (int16, error)
- func Uint16ToInt32(value uint16) (int32, error)
- func Uint16ToInt64(value uint16) (int64, error)
- func Uint16ToRune(value uint16) (rune, error)
- func Uint16ToUint(value uint16) (uint, error)
- func Uint16ToUint8(value uint16) (uint8, error)
- func Uint16ToUint16(value uint16) (uint16, error)
- func Uint16ToUint32(value uint16) (uint32, error)
- func Uint16ToUint64(value uint16) (uint64, error)
- func Uint16ToUintptr(value uint16) (uintptr, error)
- func Uint32ToByte(value uint32) (byte, error)
- func Uint32ToFloat32(value uint32) (float32, error)
- func Uint32ToFloat64(value uint32) (float64, error)
- func Uint32ToInt(value uint32) (int, error)
- func Uint32ToInt8(value uint32) (int8, error)
- func Uint32ToInt16(value uint32) (int16, error)
- func Uint32ToInt32(value uint32) (int32, error)
- func Uint32ToInt64(value uint32) (int64, error)
- func Uint32ToRune(value uint32) (rune, error)
- func Uint32ToUint(value uint32) (uint, error)
- func Uint32ToUint8(value uint32) (uint8, error)
- func Uint32ToUint16(value uint32) (uint16, error)
- func Uint32ToUint32(value uint32) (uint32, error)
- func Uint32ToUint64(value uint32) (uint64, error)
- func Uint32ToUintptr(value uint32) (uintptr, error)
- func Uint64ToByte(value uint64) (byte, error)
- func Uint64ToFloat32(value uint64) (float32, error)
- func Uint64ToFloat64(value uint64) (float64, error)
- func Uint64ToInt(value uint64) (int, error)
- func Uint64ToInt8(value uint64) (int8, error)
- func Uint64ToInt16(value uint64) (int16, error)
- func Uint64ToInt32(value uint64) (int32, error)
- func Uint64ToInt64(value uint64) (int64, error)
- func Uint64ToRune(value uint64) (rune, error)
- func Uint64ToUint(value uint64) (uint, error)
- func Uint64ToUint8(value uint64) (uint8, error)
- func Uint64ToUint16(value uint64) (uint16, error)
- func Uint64ToUint32(value uint64) (uint32, error)
- func Uint64ToUint64(value uint64) (uint64, error)
- func Uint64ToUintptr(value uint64) (uintptr, error)
- func UintToByte(value uint) (byte, error)
- func UintToFloat32(value uint) (float32, error)
- func UintToFloat64(value uint) (float64, error)
- func UintToInt(value uint) (int, error)
- func UintToInt8(value uint) (int8, error)
- func UintToInt16(value uint) (int16, error)
- func UintToInt32(value uint) (int32, error)
- func UintToInt64(value uint) (int64, error)
- func UintToRune(value uint) (rune, error)
- func UintToUint(value uint) (uint, error)
- func UintToUint8(value uint) (uint8, error)
- func UintToUint16(value uint) (uint16, error)
- func UintToUint32(value uint) (uint32, error)
- func UintToUint64(value uint) (uint64, error)
- func UintToUintptr(value uint) (uintptr, error)
- func UintptrToByte(value uintptr) (byte, error)
- func UintptrToFloat32(value uintptr) (float32, error)
- func UintptrToFloat64(value uintptr) (float64, error)
- func UintptrToInt(value uintptr) (int, error)
- func UintptrToInt8(value uintptr) (int8, error)
- func UintptrToInt16(value uintptr) (int16, error)
- func UintptrToInt32(value uintptr) (int32, error)
- func UintptrToInt64(value uintptr) (int64, error)
- func UintptrToRune(value uintptr) (rune, error)
- func UintptrToUint(value uintptr) (uint, error)
- func UintptrToUint8(value uintptr) (uint8, error)
- func UintptrToUint16(value uintptr) (uint16, error)
- func UintptrToUint32(value uintptr) (uint32, error)
- func UintptrToUint64(value uintptr) (uint64, error)
- func UintptrToUintptr(value uintptr) (uintptr, error)
Examples ¶
Constants ¶
const ( // Float32SafeIntMin represents the smallest int32 exactly representable by // the float32 type. Float32SafeIntMin = -(1 << 24) + 1 // Float32SafeIntMax represents the biggest int32 exactly representable by // the float32 type. Float32SafeIntMax = 1<<24 - 1 )
Safe integer boundaries for exact round-trip float32 to int32 conversions. The float32 can exactly represent all integers in the range [-2^24+1,2^24-1]. Outside this range, some integers cannot be represented precisely, and conversion to / from integers will lose information or round incorrectly.
const ( // Float64SafeIntMin represents the smallest int exactly representable by // the float64 type. Float64SafeIntMin = -(1 << 53) + 1 // Float64SafeIntMax represents the biggest int exactly representable by // the float64 type. Float64SafeIntMax = 1<<53 - 1 )
Safe integer boundaries for round-trip float64 to int64 conversions. The float64 can exactly represent all integers in the range [-2^53+1,2^53-1]. Outside this range, some integers cannot be represented precisely, and conversion to / from integers will lose information or round incorrectly.
Variables ¶
var ( // ErrInvRange used when the input value isn't within a valid range of the // destination type. ErrInvRange = errors.New("value out of range") // ErrInvSafeRange used when input is within the valid range for conversion, // but conversion may lose precision. ErrInvSafeRange = errors.New("value out of safe range") // ErrUnkType used when conversion for a type is not defined. ErrUnkType = errors.New("unknown type") // ErrInvType used when a type is not valid in a given conversion context. ErrInvType = errors.New("invalid type") // ErrInvValue used when a value is not valid in a given conversion context. ErrInvValue = errors.New("invalid value") // ErrInvFormat used when a value's format is not valid in a given // conversion context. ErrInvFormat = errors.New("invalid format") // ErrUndConv used when conversion is undefined for given types. ErrUndConv = errors.New("conversion undefined") // ErrUnsupported represents explicitly not supported conversion. ErrUnsupported = errors.New("not supported cast") )
Sentinel errors.
Functions ¶
func BoolToBool ¶ added in v0.3.0
BoolToBool is a nop function converting a given boolean value to boolean.
func ByteToByte ¶
ByteToByte converts a given numeric value to byte.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func ByteToFloat32 ¶
ByteToFloat32 converts a given numeric value to float32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func ByteToFloat64 ¶
ByteToFloat64 converts a given numeric value to float64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func ByteToInt ¶
ByteToInt converts a given numeric value to int.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func ByteToInt8 ¶
ByteToInt8 converts a given numeric value to int8.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func ByteToInt16 ¶
ByteToInt16 converts a given numeric value to int16.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func ByteToInt32 ¶
ByteToInt32 converts a given numeric value to int32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func ByteToInt64 ¶
ByteToInt64 converts a given numeric value to int64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func ByteToRune ¶
ByteToRune converts a given numeric value to rune.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func ByteToUint ¶
ByteToUint converts a given numeric value to uint.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func ByteToUint8 ¶
ByteToUint8 converts a given numeric value to uint8.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func ByteToUint16 ¶
ByteToUint16 converts a given numeric value to uint16.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func ByteToUint32 ¶
ByteToUint32 converts a given numeric value to uint32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func ByteToUint64 ¶
ByteToUint64 converts a given numeric value to uint64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func ByteToUintptr ¶
ByteToUintptr converts a given numeric value to uintptr.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Float32ToByte ¶
Float32ToByte converts a given numeric value to byte.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Float32ToFloat32 ¶
Float32ToFloat32 converts a given numeric value to float32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Float32ToFloat64 ¶
Float32ToFloat64 converts a given numeric value to float64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Float32ToInt ¶
Float32ToInt converts a given numeric value to int.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Float32ToInt8 ¶
Float32ToInt8 converts a given numeric value to int8.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Float32ToInt16 ¶
Float32ToInt16 converts a given numeric value to int16.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Float32ToInt32 ¶
Float32ToInt32 converts a given numeric value to int32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Float32ToInt64 ¶
Float32ToInt64 converts a given numeric value to int64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Float32ToRune ¶
Float32ToRune converts a given numeric value to rune.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Float32ToUint ¶
Float32ToUint converts a given numeric value to uint.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Float32ToUint8 ¶
Float32ToUint8 converts a given numeric value to uint8.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Float32ToUint16 ¶
Float32ToUint16 converts a given numeric value to uint16.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Float32ToUint32 ¶
Float32ToUint32 converts a given numeric value to uint32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Float32ToUint64 ¶
Float32ToUint64 converts a given numeric value to uint64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Float32ToUintptr ¶
Float32ToUintptr converts a given numeric value to uintptr.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Float64ToByte ¶
Float64ToByte converts a given numeric value to byte.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Float64ToFloat32 ¶
Float64ToFloat32 converts a given numeric value to float32. But this is one of those cases when it's easy to lose precision; therefore, only the casts of whole numbers are allowed in range from Float32SafeIntMin to Float32SafeIntMax.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Float64ToFloat64 ¶
Float64ToFloat64 converts a given numeric value to float64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Float64ToInt ¶
Float64ToInt converts a given numeric value to int.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Float64ToInt8 ¶
Float64ToInt8 converts a given numeric value to int8.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Float64ToInt16 ¶
Float64ToInt16 converts a given numeric value to int16.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Float64ToInt32 ¶
Float64ToInt32 converts a given numeric value to int32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Float64ToInt64 ¶
Float64ToInt64 converts a given numeric value to int64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Float64ToRune ¶
Float64ToRune converts a given numeric value to rune.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Float64ToUint ¶
Float64ToUint converts a given numeric value to uint.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Float64ToUint8 ¶
Float64ToUint8 converts a given numeric value to uint8.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Float64ToUint16 ¶
Float64ToUint16 converts a given numeric value to uint16.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Float64ToUint32 ¶
Float64ToUint32 converts a given numeric value to uint32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Float64ToUint64 ¶
Float64ToUint64 converts a given numeric value to uint64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Float64ToUintptr ¶
Float64ToUintptr converts a given numeric value to uintptr.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int8ToByte ¶
Int8ToByte converts a given numeric value to byte.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int8ToFloat32 ¶
Int8ToFloat32 converts a given numeric value to float32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int8ToFloat64 ¶
Int8ToFloat64 converts a given numeric value to float64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int8ToInt ¶
Int8ToInt converts a given numeric value to int.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int8ToInt8 ¶
Int8ToInt8 converts a given numeric value to int8.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int8ToInt16 ¶
Int8ToInt16 converts a given numeric value to int16.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int8ToInt32 ¶
Int8ToInt32 converts a given numeric value to int32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int8ToInt64 ¶
Int8ToInt64 converts a given numeric value to int64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int8ToRune ¶
Int8ToRune converts a given numeric value to rune.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int8ToUint ¶
Int8ToUint converts a given numeric value to uint.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int8ToUint8 ¶
Int8ToUint8 converts a given numeric value to uint8.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int8ToUint16 ¶
Int8ToUint16 converts a given numeric value to uint16.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int8ToUint32 ¶
Int8ToUint32 converts a given numeric value to uint32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int8ToUint64 ¶
Int8ToUint64 converts a given numeric value to uint64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int8ToUintptr ¶
Int8ToUintptr converts a given numeric value to uintptr.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int16ToByte ¶
Int16ToByte converts a given numeric value to byte.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int16ToFloat32 ¶
Int16ToFloat32 converts a given numeric value to float32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int16ToFloat64 ¶
Int16ToFloat64 converts a given numeric value to float64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int16ToInt ¶
Int16ToInt converts a given numeric value to int.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int16ToInt8 ¶
Int16ToInt8 converts a given numeric value to int8.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int16ToInt16 ¶
Int16ToInt16 converts a given numeric value to int16.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int16ToInt32 ¶
Int16ToInt32 converts a given numeric value to int32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int16ToInt64 ¶
Int16ToInt64 converts a given numeric value to int64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int16ToRune ¶
Int16ToRune converts a given numeric value to rune.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int16ToUint ¶
Int16ToUint converts a given numeric value to uint.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int16ToUint8 ¶
Int16ToUint8 converts a given numeric value to uint8.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int16ToUint16 ¶
Int16ToUint16 converts a given numeric value to uint16.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int16ToUint32 ¶
Int16ToUint32 converts a given numeric value to uint32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int16ToUint64 ¶
Int16ToUint64 converts a given numeric value to uint64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int16ToUintptr ¶
Int16ToUintptr converts a given numeric value to uintptr.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int32ToByte ¶
Int32ToByte converts a given numeric value to byte.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int32ToFloat32 ¶
Int32ToFloat32 converts a given numeric value to float32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int32ToFloat64 ¶
Int32ToFloat64 converts a given numeric value to float64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int32ToInt ¶
Int32ToInt converts a given numeric value to int.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int32ToInt8 ¶
Int32ToInt8 converts a given numeric value to int8.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int32ToInt16 ¶
Int32ToInt16 converts a given numeric value to int16.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int32ToInt32 ¶
Int32ToInt32 converts a given numeric value to int32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int32ToInt64 ¶
Int32ToInt64 converts a given numeric value to int64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int32ToRune ¶
Int32ToRune converts a given numeric value to rune.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int32ToUint ¶
Int32ToUint converts a given numeric value to uint.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int32ToUint8 ¶
Int32ToUint8 converts a given numeric value to uint8.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int32ToUint16 ¶
Int32ToUint16 converts a given numeric value to uint16.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int32ToUint32 ¶
Int32ToUint32 converts a given numeric value to uint32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int32ToUint64 ¶
Int32ToUint64 converts a given numeric value to uint64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int32ToUintptr ¶
Int32ToUintptr converts a given numeric value to uintptr.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int64ToByte ¶
Int64ToByte converts a given numeric value to byte.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int64ToFloat32 ¶
Int64ToFloat32 converts a given numeric value to float32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int64ToFloat64 ¶
Int64ToFloat64 converts a given numeric value to float64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int64ToInt ¶
Int64ToInt converts a given numeric value to int.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int64ToInt8 ¶
Int64ToInt8 converts a given numeric value to int8.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int64ToInt16 ¶
Int64ToInt16 converts a given numeric value to int16.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int64ToInt32 ¶
Int64ToInt32 converts a given numeric value to int32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int64ToInt64 ¶
Int64ToInt64 converts a given numeric value to int64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int64ToRune ¶
Int64ToRune converts a given numeric value to rune.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int64ToUint ¶
Int64ToUint converts a given numeric value to uint.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int64ToUint8 ¶
Int64ToUint8 converts a given numeric value to uint8.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int64ToUint16 ¶
Int64ToUint16 converts a given numeric value to uint16.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int64ToUint32 ¶
Int64ToUint32 converts a given numeric value to uint32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int64ToUint64 ¶
Int64ToUint64 converts a given numeric value to uint64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Int64ToUintptr ¶
Int64ToUintptr converts a given numeric value to uintptr.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func IntToByte ¶
IntToByte converts a given numeric value to byte.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func IntToFloat32 ¶
IntToFloat32 converts a given numeric value to float32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func IntToFloat64 ¶
IntToFloat64 converts a given numeric value to float64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func IntToInt ¶
IntToInt converts a given numeric value to int.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func IntToInt8 ¶
IntToInt8 converts a given numeric value to int8.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func IntToInt16 ¶
IntToInt16 converts a given numeric value to int16.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func IntToInt32 ¶
IntToInt32 converts a given numeric value to int32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func IntToInt64 ¶
IntToInt64 converts a given numeric value to int64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func IntToRune ¶
IntToRune converts a given numeric value to rune.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func IntToUint ¶
IntToUint converts a given numeric value to uint.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func IntToUint8 ¶
IntToUint8 converts a given numeric value to uint8.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func IntToUint16 ¶
IntToUint16 converts a given numeric value to uint16.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func IntToUint32 ¶
IntToUint32 converts a given numeric value to uint32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func IntToUint64 ¶
IntToUint64 converts a given numeric value to uint64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func IntToUintptr ¶
IntToUintptr converts a given numeric value to uintptr.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func RuneToByte ¶
RuneToByte converts a given numeric value to byte.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func RuneToFloat32 ¶
RuneToFloat32 converts a given numeric value to float32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func RuneToFloat64 ¶
RuneToFloat64 converts a given numeric value to float64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func RuneToInt ¶
RuneToInt converts a given numeric value to int.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func RuneToInt8 ¶
RuneToInt8 converts a given numeric value to int8.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func RuneToInt16 ¶
RuneToInt16 converts a given numeric value to int16.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func RuneToInt32 ¶
RuneToInt32 converts a given numeric value to int32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func RuneToInt64 ¶
RuneToInt64 converts a given numeric value to int64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func RuneToRune ¶
RuneToRune converts a given numeric value to rune.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func RuneToUint ¶
RuneToUint converts a given numeric value to uint.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func RuneToUint8 ¶
RuneToUint8 converts a given numeric value to uint8.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func RuneToUint16 ¶
RuneToUint16 converts a given numeric value to uint16.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func RuneToUint32 ¶
RuneToUint32 converts a given numeric value to uint32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func RuneToUint64 ¶
RuneToUint64 converts a given numeric value to uint64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func RuneToUintptr ¶
RuneToUintptr converts a given numeric value to uintptr.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func StringToDuration ¶ added in v0.3.0
StringToDuration returns a parser function that converts a string to a time.Duration. If parsing fails, the returned function yields a zero time.Duration and an error describing the issue.
func StringToString ¶ added in v0.3.0
StringToString is a nop function converting a given string value to string.
func StringToTime ¶ added in v0.2.0
StringToTime returns a parser function that converts a string to a time.Time according to the specified layout. The layout must follow time.Parse rules. If parsing fails, the returned function yields a zero time.Time and an error describing the issue.
func SupportedTypes ¶
SupportedTypes returns a slice of reflect.Type instances containing all types for which the package provides built-in converters. Any pair of types from this list can be converted in either direction.
func Uint8ToByte ¶
Uint8ToByte converts a given numeric value to byte.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint8ToFloat32 ¶
Uint8ToFloat32 converts a given numeric value to float32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint8ToFloat64 ¶
Uint8ToFloat64 converts a given numeric value to float64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint8ToInt ¶
Uint8ToInt converts a given numeric value to int.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint8ToInt8 ¶
Uint8ToInt8 converts a given numeric value to int8.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint8ToInt16 ¶
Uint8ToInt16 converts a given numeric value to int16.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint8ToInt32 ¶
Uint8ToInt32 converts a given numeric value to int32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint8ToInt64 ¶
Uint8ToInt64 converts a given numeric value to int64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint8ToRune ¶
Uint8ToRune converts a given numeric value to rune.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint8ToUint ¶
Uint8ToUint converts a given numeric value to uint.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint8ToUint8 ¶
Uint8ToUint8 converts a given numeric value to uint8.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint8ToUint16 ¶
Uint8ToUint16 converts a given numeric value to uint16.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint8ToUint32 ¶
Uint8ToUint32 converts a given numeric value to uint32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint8ToUint64 ¶
Uint8ToUint64 converts a given numeric value to uint64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint8ToUintptr ¶
Uint8ToUintptr converts a given numeric value to uintptr.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint16ToByte ¶
Uint16ToByte converts a given numeric value to byte.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint16ToFloat32 ¶
Uint16ToFloat32 converts a given numeric value to float32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint16ToFloat64 ¶
Uint16ToFloat64 converts a given numeric value to float64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint16ToInt ¶
Uint16ToInt converts a given numeric value to int.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint16ToInt8 ¶
Uint16ToInt8 converts a given numeric value to int8.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint16ToInt16 ¶
Uint16ToInt16 converts a given numeric value to int16.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint16ToInt32 ¶
Uint16ToInt32 converts a given numeric value to int32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint16ToInt64 ¶
Uint16ToInt64 converts a given numeric value to int64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint16ToRune ¶
Uint16ToRune converts a given numeric value to rune.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint16ToUint ¶
Uint16ToUint converts a given numeric value to uint.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint16ToUint8 ¶
Uint16ToUint8 converts a given numeric value to uint8.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint16ToUint16 ¶
Uint16ToUint16 converts a given numeric value to uint16.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint16ToUint32 ¶
Uint16ToUint32 converts a given numeric value to uint32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint16ToUint64 ¶
Uint16ToUint64 converts a given numeric value to uint64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint16ToUintptr ¶
Uint16ToUintptr converts a given numeric value to uintptr.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint32ToByte ¶
Uint32ToByte converts a given numeric value to byte.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint32ToFloat32 ¶
Uint32ToFloat32 converts a given numeric value to float32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint32ToFloat64 ¶
Uint32ToFloat64 converts a given numeric value to float64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint32ToInt ¶
Uint32ToInt converts a given numeric value to int.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint32ToInt8 ¶
Uint32ToInt8 converts a given numeric value to int8.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint32ToInt16 ¶
Uint32ToInt16 converts a given numeric value to int16.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint32ToInt32 ¶
Uint32ToInt32 converts a given numeric value to int32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint32ToInt64 ¶
Uint32ToInt64 converts a given numeric value to int64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint32ToRune ¶
Uint32ToRune converts a given numeric value to rune.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint32ToUint ¶
Uint32ToUint converts a given numeric value to uint.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint32ToUint8 ¶
Uint32ToUint8 converts a given numeric value to uint8.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint32ToUint16 ¶
Uint32ToUint16 converts a given numeric value to uint16.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint32ToUint32 ¶
Uint32ToUint32 converts a given numeric value to uint32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint32ToUint64 ¶
Uint32ToUint64 converts a given numeric value to uint64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint32ToUintptr ¶
Uint32ToUintptr converts a given numeric value to uintptr.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint64ToByte ¶
Uint64ToByte converts a given numeric value to byte.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint64ToFloat32 ¶
Uint64ToFloat32 converts a given numeric value to float32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint64ToFloat64 ¶
Uint64ToFloat64 converts a given numeric value to float64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint64ToInt ¶
Uint64ToInt converts a given numeric value to int.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint64ToInt8 ¶
Uint64ToInt8 converts a given numeric value to int8.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint64ToInt16 ¶
Uint64ToInt16 converts a given numeric value to int16.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint64ToInt32 ¶
Uint64ToInt32 converts a given numeric value to int32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint64ToInt64 ¶
Uint64ToInt64 converts a given numeric value to int64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint64ToRune ¶
Uint64ToRune converts a given numeric value to rune.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint64ToUint ¶
Uint64ToUint converts a given numeric value to uint.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint64ToUint8 ¶
Uint64ToUint8 converts a given numeric value to uint8.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint64ToUint16 ¶
Uint64ToUint16 converts a given numeric value to uint16.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint64ToUint32 ¶
Uint64ToUint32 converts a given numeric value to uint32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint64ToUint64 ¶
Uint64ToUint64 converts a given numeric value to uint64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func Uint64ToUintptr ¶
Uint64ToUintptr converts a given numeric value to uintptr.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func UintToByte ¶
UintToByte converts a given numeric value to byte.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func UintToFloat32 ¶
UintToFloat32 converts a given numeric value to float32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func UintToFloat64 ¶
UintToFloat64 converts a given numeric value to float64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func UintToInt ¶
UintToInt converts a given numeric value to int.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func UintToInt8 ¶
UintToInt8 converts a given numeric value to int8.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func UintToInt16 ¶
UintToInt16 converts a given numeric value to int16.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func UintToInt32 ¶
UintToInt32 converts a given numeric value to int32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func UintToInt64 ¶
UintToInt64 converts a given numeric value to int64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func UintToRune ¶
UintToRune converts a given numeric value to rune.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func UintToUint ¶
UintToUint converts a given numeric value to uint.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func UintToUint8 ¶
UintToUint8 converts a given numeric value to uint8.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func UintToUint16 ¶
UintToUint16 converts a given numeric value to uint16.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func UintToUint32 ¶
UintToUint32 converts a given numeric value to uint32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func UintToUint64 ¶
UintToUint64 converts a given numeric value to uint64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func UintToUintptr ¶
UintToUintptr converts a given numeric value to uintptr.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func UintptrToByte ¶
UintptrToByte converts a given numeric value to byte.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func UintptrToFloat32 ¶
UintptrToFloat32 converts a given numeric value to float32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func UintptrToFloat64 ¶
UintptrToFloat64 converts a given numeric value to float64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func UintptrToInt ¶
UintptrToInt converts a given numeric value to int.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func UintptrToInt8 ¶
UintptrToInt8 converts a given numeric value to int8.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func UintptrToInt16 ¶
UintptrToInt16 converts a given numeric value to int16.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func UintptrToInt32 ¶
UintptrToInt32 converts a given numeric value to int32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func UintptrToInt64 ¶
UintptrToInt64 converts a given numeric value to int64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func UintptrToRune ¶
UintptrToRune converts a given numeric value to rune.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func UintptrToUint ¶
UintptrToUint converts a given numeric value to uint.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func UintptrToUint8 ¶
UintptrToUint8 converts a given numeric value to uint8.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func UintptrToUint16 ¶
UintptrToUint16 converts a given numeric value to uint16.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func UintptrToUint32 ¶
UintptrToUint32 converts a given numeric value to uint32.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func UintptrToUint64 ¶
UintptrToUint64 converts a given numeric value to uint64.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
func UintptrToUintptr ¶
UintptrToUintptr converts a given numeric value to uintptr.
It succeeds only if the numeric value can be exactly preserved without loss or truncation. Otherwise, it returns an error.
Types ¶
This section is empty.
Source Files
¶
- bool_to_bool.go
- byte_to_byte.go
- byte_to_float32.go
- byte_to_float64.go
- byte_to_int.go
- byte_to_int16.go
- byte_to_int32.go
- byte_to_int64.go
- byte_to_int8.go
- byte_to_rune.go
- byte_to_uint.go
- byte_to_uint16.go
- byte_to_uint32.go
- byte_to_uint64.go
- byte_to_uint8.go
- byte_to_uintptr.go
- float32_to_byte.go
- float32_to_float32.go
- float32_to_float64.go
- float32_to_int.go
- float32_to_int16.go
- float32_to_int32.go
- float32_to_int64.go
- float32_to_int8.go
- float32_to_rune.go
- float32_to_uint.go
- float32_to_uint16.go
- float32_to_uint32.go
- float32_to_uint64.go
- float32_to_uint8.go
- float32_to_uintptr.go
- float64_to_byte.go
- float64_to_float32.go
- float64_to_float64.go
- float64_to_int16.go
- float64_to_int32.go
- float64_to_int64.go
- float64_to_int8.go
- float64_to_int_64bit.go
- float64_to_rune.go
- float64_to_uint16.go
- float64_to_uint32.go
- float64_to_uint64.go
- float64_to_uint8.go
- float64_to_uint_64bit.go
- float64_to_uintptr_64bit.go
- int16_to_byte.go
- int16_to_float32.go
- int16_to_float64.go
- int16_to_int.go
- int16_to_int16.go
- int16_to_int32.go
- int16_to_int64.go
- int16_to_int8.go
- int16_to_rune.go
- int16_to_uint.go
- int16_to_uint16.go
- int16_to_uint32.go
- int16_to_uint64.go
- int16_to_uint8.go
- int16_to_uintptr.go
- int32_to_byte.go
- int32_to_float32.go
- int32_to_float64.go
- int32_to_int.go
- int32_to_int16.go
- int32_to_int32.go
- int32_to_int64.go
- int32_to_int8.go
- int32_to_rune.go
- int32_to_uint.go
- int32_to_uint16.go
- int32_to_uint32.go
- int32_to_uint64.go
- int32_to_uint8.go
- int32_to_uintptr.go
- int64_to_byte.go
- int64_to_float32.go
- int64_to_float64.go
- int64_to_int.go
- int64_to_int16.go
- int64_to_int32.go
- int64_to_int64.go
- int64_to_int8.go
- int64_to_rune.go
- int64_to_uint16.go
- int64_to_uint32.go
- int64_to_uint64.go
- int64_to_uint8.go
- int64_to_uint_64bit.go
- int64_to_uintptr_64bit.go
- int8_to_byte.go
- int8_to_float32.go
- int8_to_float64.go
- int8_to_int.go
- int8_to_int16.go
- int8_to_int32.go
- int8_to_int64.go
- int8_to_int8.go
- int8_to_rune.go
- int8_to_uint.go
- int8_to_uint16.go
- int8_to_uint32.go
- int8_to_uint64.go
- int8_to_uint8.go
- int8_to_uintptr.go
- int_to_byte.go
- int_to_float32.go
- int_to_float64_64bit.go
- int_to_int.go
- int_to_int16.go
- int_to_int32.go
- int_to_int64.go
- int_to_int8.go
- int_to_rune.go
- int_to_uint.go
- int_to_uint16.go
- int_to_uint32_64bit.go
- int_to_uint64.go
- int_to_uint8.go
- int_to_uintptr.go
- rune_to_byte.go
- rune_to_float32.go
- rune_to_float64.go
- rune_to_int.go
- rune_to_int16.go
- rune_to_int32.go
- rune_to_int64.go
- rune_to_int8.go
- rune_to_rune.go
- rune_to_uint.go
- rune_to_uint16.go
- rune_to_uint32.go
- rune_to_uint64.go
- rune_to_uint8.go
- rune_to_uintptr.go
- string_to_duration.go
- string_to_string.go
- string_to_time.go
- uint16_to_byte.go
- uint16_to_float32.go
- uint16_to_float64.go
- uint16_to_int.go
- uint16_to_int16.go
- uint16_to_int32.go
- uint16_to_int64.go
- uint16_to_int8.go
- uint16_to_rune.go
- uint16_to_uint.go
- uint16_to_uint16.go
- uint16_to_uint32.go
- uint16_to_uint64.go
- uint16_to_uint8.go
- uint16_to_uintptr.go
- uint32_to_byte.go
- uint32_to_float32.go
- uint32_to_float64.go
- uint32_to_int16.go
- uint32_to_int32.go
- uint32_to_int64.go
- uint32_to_int8.go
- uint32_to_int_64bit.go
- uint32_to_rune.go
- uint32_to_uint.go
- uint32_to_uint16.go
- uint32_to_uint32.go
- uint32_to_uint64.go
- uint32_to_uint8.go
- uint32_to_uintptr.go
- uint64_to_byte.go
- uint64_to_float32.go
- uint64_to_float64.go
- uint64_to_int.go
- uint64_to_int16.go
- uint64_to_int32.go
- uint64_to_int64.go
- uint64_to_int8.go
- uint64_to_rune.go
- uint64_to_uint16.go
- uint64_to_uint32.go
- uint64_to_uint64.go
- uint64_to_uint8.go
- uint64_to_uint_64bit.go
- uint64_to_uintptr_64bit.go
- uint8_to_byte.go
- uint8_to_float32.go
- uint8_to_float64.go
- uint8_to_int.go
- uint8_to_int16.go
- uint8_to_int32.go
- uint8_to_int64.go
- uint8_to_int8.go
- uint8_to_rune.go
- uint8_to_uint.go
- uint8_to_uint16.go
- uint8_to_uint32.go
- uint8_to_uint64.go
- uint8_to_uint8.go
- uint8_to_uintptr.go
- uint_to_byte.go
- uint_to_float32.go
- uint_to_float64_64bit.go
- uint_to_int.go
- uint_to_int16.go
- uint_to_int32.go
- uint_to_int64_64bit.go
- uint_to_int8.go
- uint_to_rune.go
- uint_to_uint.go
- uint_to_uint16.go
- uint_to_uint32_64bit.go
- uint_to_uint64.go
- uint_to_uint8.go
- uint_to_uintptr.go
- uintptr_to_byte.go
- uintptr_to_float32.go
- uintptr_to_float64_64bit.go
- uintptr_to_int.go
- uintptr_to_int16.go
- uintptr_to_int32.go
- uintptr_to_int64_64bit.go
- uintptr_to_int8.go
- uintptr_to_rune.go
- uintptr_to_uint.go
- uintptr_to_uint16.go
- uintptr_to_uint32_64bit.go
- uintptr_to_uint64.go
- uintptr_to_uint8.go
- uintptr_to_uintptr.go
- xcast.go