dtypes

package
v0.0.0-...-baf6593 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SerializableInt

type SerializableInt struct {
	// contains filtered or unexported fields
}

SerializableInt is basically copied from cosmos-sdk/types/Int but: - doesn’t have a bit-length restriction - uses GobEncode/GobDecode instead of serializing to an ascii string - removes superfluous functions to do `big.Int` math on the underlying value

func NewInt

func NewInt(n int64) SerializableInt

NewInt constructs Int from int64

func NewIntFromBigInt

func NewIntFromBigInt(i *big.Int) SerializableInt

NewIntFromBigInt constructs Int from big.Int. If the provided big.Int is nil,

func NewIntFromUint64

func NewIntFromUint64(n uint64) SerializableInt

NewIntFromUint64 constructs an Int from a uint64.

func ZeroInt

func ZeroInt() SerializableInt

ZeroInt returns Int value with zero

func (SerializableInt) BigInt

func (i SerializableInt) BigInt() *big.Int

BigInt converts Int to big.Int

func (SerializableInt) Cmp

Cmp compares x and y and returns:

-1 if (x <  y) OR (x is nil and y is not nil)
 0 if (x == y) OR (x is nil and y is nil)
+1 if (x >  y) OR (x is not nil and y is nil

This is similar to big.Int.Cmp where nil values sort first.

func (SerializableInt) IsNil

func (i SerializableInt) IsNil() bool

IsNil returns true if Int is uninitialized

func (SerializableInt) Marshal

func (i SerializableInt) Marshal() ([]byte, error)

Marshal implements the gogo proto custom type interface.

func (SerializableInt) MarshalJSON

func (i SerializableInt) MarshalJSON() ([]byte, error)

MarshalJSON defines custom encoding scheme

func (*SerializableInt) MarshalTo

func (i *SerializableInt) MarshalTo(data []byte) (n int, err error)

MarshalTo implements the gogo proto custom type interface.

func (*SerializableInt) Size

func (i *SerializableInt) Size() int

Size implements the gogo proto custom type interface.

func (SerializableInt) String

func (i SerializableInt) String() string

func (*SerializableInt) Unmarshal

func (i *SerializableInt) Unmarshal(data []byte) error

Unmarshal implements the gogo proto custom type interface.

func (*SerializableInt) UnmarshalJSON

func (i *SerializableInt) UnmarshalJSON(bz []byte) error

UnmarshalJSON defines custom decoding scheme

Jump to

Keyboard shortcuts

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