Documentation
¶
Index ¶
- func DecFloat32(b []byte) (f float32)
- func DecFloat64(b []byte) (f float64)
- func DecInt32(b []byte) int32
- func DecInt64(b []byte) int64
- func DecUint128(b []byte) (i *big.Int)
- func DecUint16(b []byte) uint16
- func DecUint32(b []byte) uint32
- func DecUint64(b []byte) uint64
- func EncFloat32(f float32) (b []byte)
- func EncFloat64(f float64) (b []byte)
- func EncInt32(i int32) (b []byte)
- func EncInt64(i int64) (b []byte)
- func EncUint128(i *big.Int) (b []byte)
- func EncUint16(i uint16) (b []byte)
- func EncUint32(i uint32) (b []byte)
- func EncUint64(i uint64) (b []byte)
- func Marshal(v interface{}) ([]byte, error)
- func Unmarshal(b []byte, v interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecFloat32 ¶
DecFloat32 decodes a slice of 4 bytes into a float32. It panics if len(b) < 4.
func DecFloat64 ¶
DecFloat64 decodes a slice of 8 bytes into a float64. It panics if len(b) < 8.
func DecUint128 ¶
DecUint128 decodes a slice of 16 bytes into a big.Int It panics if len(b) < 16.
func EncFloat32 ¶
EncFloat32 encodes a float32 as a slice of 4 bytes.
func EncFloat64 ¶
EncFloat64 encodes a float64 as a slice of 8 bytes.
func EncUint128 ¶
EncUint128 encodes a big.Int as a slice of 16 bytes. big.Ints are stored in big-endian format, so they must be converted to little-endian before being returned.
func Marshal ¶
Marshal is the generic function used to marshal all public and over-the-wire data used on Sia. By implementation, it's just making a call to json. We use our own function, however, because if the spec is changed to use an encoding other than json (which is likely), then it we will only need to make changes in one place.
Types ¶
This section is empty.