package rlpstruct
import "github.com/ethereum/go-ethereum/rlp/internal/rlpstruct"
Package rlpstruct implements struct processing for RLP encoding/decoding.
In particular, this package handles all rules around field filtering, struct tags and nil value determination.
Index ¶
- func ProcessFields(allFields []Field) ([]Field, []Tags, error)
- type Field
- type NilKind
- type TagError
- type Tags
- type Type
Functions ¶
func ProcessFields ¶
ProcessFields filters the given struct fields, returning only fields that should be considered for encoding/decoding.
Types ¶
type Field ¶
Field represents a struct field.
type NilKind ¶
type NilKind uint8
NilKind is the RLP value encoded in place of nil pointers.
type TagError ¶
type TagError struct { StructType string // These are set by this package. Field string Tag string Err string }
TagError is raised for invalid struct tags.
func (TagError) Error ¶
type Tags ¶
type Tags struct { // rlp:"nil" controls whether empty input results in a nil pointer. // nilKind is the kind of empty value allowed for the field. NilKind NilKind NilOK bool // rlp:"optional" allows for a field to be missing in the input list. // If this is set, all subsequent fields must also be optional. Optional bool // rlp:"tail" controls whether this field swallows additional list elements. It can // only be set for the last field, which must be of slice type. Tail bool // rlp:"-" ignores fields. Ignored bool }
Tags represents struct tags.
type Type ¶
type Type struct { Name string Kind reflect.Kind IsEncoder bool // whether type implements rlp.Encoder IsDecoder bool // whether type implements rlp.Decoder Elem *Type // non-nil for Kind values of Ptr, Slice, Array }
Type represents the attributes of a Go type.
func (Type) DefaultNilValue ¶
DefaultNilValue determines whether a nil pointer to t encodes/decodes as an empty string or empty list.
Source Files ¶
- Version
- v1.16.1 (latest)
- Published
- Jul 2, 2025
- Platform
- linux/amd64
- Imports
- 3 packages
- Last checked
- 6 hours ago –
Tools for package owners.