Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrResultAlreadySet = errors.New("result already has an assigned value")
var MaxUint128 = &Uint128{ Upper: ^uint64(0), Lower: ^uint64(0), }
MaxUint128 is the maximum uint128 value
Functions ¶
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder is used to decode from an io.Reader
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
Result encapsulates an Ok or an Err case
func NewResult ¶
func NewResult(okIn, errIn interface{}) (res Result)
NewResult is constructor for Result. Use nil to represent empty tuple () in Rust.
func (*Result) Set ¶
func (r *Result) Set(mode ResultMode, in interface{}) (err error)
Set takes in a mode (OK/Err) and the associated interface and sets the Result value
type ResultMode ¶
type ResultMode int
ResultMode is the mode the Result is set to
const ( // Unset ResultMode is zero value mode Unset ResultMode = iota // OK case OK // Err case Err )
type Uint128 ¶
Uint128 represents an unsigned 128 bit integer
func MustNewUint128 ¶
MustNewUint128 will panic if NewUint128 returns an error
func NewUint128 ¶
NewUint128 is constructor for Uint128 that accepts an option binary.ByteOrder option is only used when inputted interface{} is of type []byte by default binary.LittleEndian is used for []byte since this is SCALE
func (*Uint128) Bytes ¶
Bytes returns the Uint128 in little endian format by default. A variadic parameter order can be used to specify the binary.ByteOrder used
func (*Uint128) Compare ¶
Compare returns 1 if the receiver is greater than other, 0 if they are equal, and -1 otherwise.
func (*Uint128) UnmarshalJSON ¶
UnmarshalJSON converts data to Uint128.
type VaryingDataType ¶
type VaryingDataType struct {
// contains filtered or unexported fields
}
VaryingDataType is analogous to a rust enum. Name is taken from polkadot spec.
func MustNewVaryingDataType ¶
func MustNewVaryingDataType(values ...VaryingDataTypeValue) (vdt VaryingDataType)
MustNewVaryingDataType is constructor for VaryingDataType
func NewVaryingDataType ¶
func NewVaryingDataType(values ...VaryingDataTypeValue) (vdt VaryingDataType, err error)
NewVaryingDataType is constructor for VaryingDataType
func (*VaryingDataType) Set ¶
func (vdt *VaryingDataType) Set(value VaryingDataTypeValue) (err error)
Set will set the VaryingDataType value
func (*VaryingDataType) Value ¶
func (vdt *VaryingDataType) Value() VaryingDataTypeValue
Value returns value stored in vdt
type VaryingDataTypeSlice ¶
type VaryingDataTypeSlice struct { VaryingDataType Types []VaryingDataType }
VaryingDataTypeSlice is used to represent []VaryingDataType. SCALE requires knowledge of the underlying data, so it is required to have the VaryingDataType required for decoding
func NewVaryingDataTypeSlice ¶
func NewVaryingDataTypeSlice(vdt VaryingDataType) (vdts VaryingDataTypeSlice)
NewVaryingDataTypeSlice is constructor for VaryingDataTypeSlice
func (*VaryingDataTypeSlice) Add ¶
func (vdts *VaryingDataTypeSlice) Add(values ...VaryingDataTypeValue) (err error)
Add takes variadic parameter values to add VaryingDataTypeValue(s)
type VaryingDataTypeValue ¶
type VaryingDataTypeValue interface {
Index() uint
}
VaryingDataTypeValue is used to represent scale encodable types of an associated VaryingDataType
type WrappedErr ¶
type WrappedErr struct {
Err interface{}
}
WrappedErr is returned by Result.Unwrap(). The underlying Err value is wrapped and stored in Err attribute