optional

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: LGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Body

type Body struct {
	Exists bool
	Value  CoreBody
}

Body represents an optional types.Body. The fields need to be exported since it's JSON encoded by the state service. TODO: when we change the state service's encoding to SCALE, these fields should become unexported.

func NewBody

func NewBody(exists bool, value CoreBody) *Body

NewBody returns a new optional.Body

func (*Body) Set

func (x *Body) Set(exists bool, value CoreBody)

Set sets the exists and value fields.

func (*Body) String

func (x *Body) String() string

String returns the value as a string.

type Bytes

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

Bytes represents an optional Bytes type.

func NewBytes

func NewBytes(exists bool, value []byte) *Bytes

NewBytes returns a new optional.Bytes

func (*Bytes) Decode added in v0.2.0

func (x *Bytes) Decode(r io.Reader) (*Bytes, error)

Decode return an optional Byte from scale encoded data

func (*Bytes) Encode added in v0.2.0

func (x *Bytes) Encode() ([]byte, error)

Encode returns the SCALE encoded optional

func (*Bytes) Exists

func (x *Bytes) Exists() bool

Exists returns true if the value is Some, false if it is None.

func (*Bytes) Set

func (x *Bytes) Set(exists bool, value []byte)

Set sets the exists and value fields.

func (*Bytes) String

func (x *Bytes) String() string

String returns the value as a string.

func (*Bytes) Value

func (x *Bytes) Value() []byte

Value returns the []byte value. It returns nil if it is None.

type CoreBody

type CoreBody []byte

CoreBody is the extrinsics inside a state block

type CoreHeader

type CoreHeader struct {
	ParentHash     common.Hash `json:"parentHash"`
	Number         *big.Int    `json:"number"`
	StateRoot      common.Hash `json:"stateRoot"`
	ExtrinsicsRoot common.Hash `json:"extrinsicsRoot"`
	Digest         [][]byte    `json:"digest"`
}

CoreHeader is a state block header This is copied from core/types since core/types imports this package, we cannot import core/types.

type Hash

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

Hash represents an optional Hash type.

func NewHash

func NewHash(exists bool, value common.Hash) *Hash

NewHash returns a new optional.Hash

func (*Hash) Exists

func (x *Hash) Exists() bool

Exists returns true if the value is Some, false if it is None.

func (*Hash) Set

func (x *Hash) Set(exists bool, value common.Hash)

Set sets the exists and value fields.

func (*Hash) String

func (x *Hash) String() string

String returns the value as a string.

func (*Hash) Value

func (x *Hash) Value() common.Hash

Value returns Hash Value

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

Header represents an optional header type

func NewHeader

func NewHeader(exists bool, value *CoreHeader) *Header

NewHeader returns a new optional.Header

func (*Header) Exists

func (x *Header) Exists() bool

Exists returns true if the value is Some, false if it is None.

func (*Header) Set

func (x *Header) Set(exists bool, value *CoreHeader)

Set sets the exists and value fields.

func (*Header) String

func (x *Header) String() string

String returns the value as a string.

func (*Header) Value

func (x *Header) Value() *CoreHeader

Value returns the value of the header. It returns nil if the header is None.

type Uint32

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

Uint32 represents an optional uint32 type.

func NewUint32

func NewUint32(exists bool, value uint32) *Uint32

NewUint32 returns a new optional.Uint32

func (*Uint32) Exists

func (x *Uint32) Exists() bool

Exists returns true if the value is Some, false if it is None.

func (*Uint32) Set

func (x *Uint32) Set(exists bool, value uint32)

Set sets the exists and value fields.

func (*Uint32) String

func (x *Uint32) String() string

String returns the value as a string.

func (*Uint32) Value

func (x *Uint32) Value() uint32

Value returns the uint32 value. It returns 0 if it is None.

Jump to

Keyboard shortcuts

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