encoding

package
v0.1.1-experimental.3 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bytes32ValueCodec

type Bytes32ValueCodec struct{}

Bytes32ValueCodec provides methods to encode and decode [32]byte values.

func (Bytes32ValueCodec) Decode

func (Bytes32ValueCodec) Decode(b []byte) ([32]byte, error)

Decode unmarshals the provided bytes into a value of type [32]byte.

func (Bytes32ValueCodec) DecodeJSON

func (Bytes32ValueCodec) DecodeJSON(_ []byte) ([32]byte, error)

DecodeJSON is not implemented and will panic if called.

func (Bytes32ValueCodec) Encode

func (Bytes32ValueCodec) Encode(value [32]byte) ([]byte, error)

Encode marshals the provided value into its [32]byte encoding.

func (Bytes32ValueCodec) EncodeJSON

func (Bytes32ValueCodec) EncodeJSON(_ [32]byte) ([]byte, error)

EncodeJSON is not implemented and will panic if called.

func (Bytes32ValueCodec) Stringify

func (Bytes32ValueCodec) Stringify(value [32]byte) string

Stringify returns the string representation of the provided value.

func (Bytes32ValueCodec) ValueType

func (Bytes32ValueCodec) ValueType() string

ValueType returns the name of the interface that this codec is intended for.

type SSZMarshallable

type SSZMarshallable interface {
	fssz.Marshaler
	fssz.Unmarshaler
	String() string
}

SSZMarshallable defines an interface for types that can be marshaled and unmarshaled using SSZ encoding, and also provides a string representation of the type.

type SSZValueCodec

type SSZValueCodec[T SSZMarshallable] struct{}

SSZValueCodec provides methods to encode and decode SSZ values.

func (SSZValueCodec[T]) Decode

func (SSZValueCodec[T]) Decode(b []byte) (T, error)

Decode unmarshals the provided bytes into a value of type T.

func (SSZValueCodec[T]) DecodeJSON

func (SSZValueCodec[T]) DecodeJSON(_ []byte) (T, error)

DecodeJSON is not implemented and will panic if called.

func (SSZValueCodec[T]) Encode

func (SSZValueCodec[T]) Encode(value T) ([]byte, error)

Encode marshals the provided value into its SSZ encoding.

func (SSZValueCodec[T]) EncodeJSON

func (SSZValueCodec[T]) EncodeJSON(_ T) ([]byte, error)

EncodeJSON is not implemented and will panic if called.

func (SSZValueCodec[T]) Stringify

func (SSZValueCodec[T]) Stringify(value T) string

Stringify returns the string representation of the provided value.

func (SSZValueCodec[T]) ValueType

func (SSZValueCodec[T]) ValueType() string

ValueType returns the name of the interface that this codec is intended for.

Jump to

Keyboard shortcuts

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