mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
parent
b6c0234e0b
commit
d059c60a63
2 changed files with 9 additions and 5 deletions
|
|
@ -115,15 +115,17 @@ type Decoder interface {
|
||||||
// type, Decode will return an error. Decode also supports *big.Int.
|
// type, Decode will return an error. Decode also supports *big.Int.
|
||||||
// There is no size limit for big integers.
|
// There is no size limit for big integers.
|
||||||
//
|
//
|
||||||
|
// To decode into a boolean, the input must contain an unsigned integer
|
||||||
|
// of value zero (false) or one (true).
|
||||||
|
//
|
||||||
// To decode into an interface value, Decode stores one of these
|
// To decode into an interface value, Decode stores one of these
|
||||||
// in the value:
|
// in the value:
|
||||||
//
|
//
|
||||||
// []interface{}, for RLP lists
|
// []interface{}, for RLP lists
|
||||||
// []byte, for RLP strings
|
// []byte, for RLP strings
|
||||||
//
|
//
|
||||||
// Non-empty interface types are not supported, nor are booleans,
|
// Non-empty interface types are not supported, nor are signed integers,
|
||||||
// signed integers, floating point numbers, maps, channels and
|
// floating point numbers, maps, channels and functions.
|
||||||
// functions.
|
|
||||||
//
|
//
|
||||||
// Note that Decode does not set an input limit for all readers
|
// Note that Decode does not set an input limit for all readers
|
||||||
// and may be vulnerable to panics cause by huge value sizes. If
|
// and may be vulnerable to panics cause by huge value sizes. If
|
||||||
|
|
|
||||||
|
|
@ -73,10 +73,12 @@ type Encoder interface {
|
||||||
// An unsigned integer value is encoded as an RLP string. Zero always
|
// An unsigned integer value is encoded as an RLP string. Zero always
|
||||||
// encodes as an empty RLP string. Encode also supports *big.Int.
|
// encodes as an empty RLP string. Encode also supports *big.Int.
|
||||||
//
|
//
|
||||||
|
// Boolean values are encoded as unsigned integers zero (false) and one (true).
|
||||||
|
//
|
||||||
// An interface value encodes as the value contained in the interface.
|
// An interface value encodes as the value contained in the interface.
|
||||||
//
|
//
|
||||||
// Boolean values are not supported, nor are signed integers, floating
|
// Signed integers are not supported, nor are floating point numbers, maps,
|
||||||
// point numbers, maps, channels and functions.
|
// channels and functions.
|
||||||
func Encode(w io.Writer, val interface{}) error {
|
func Encode(w io.Writer, val interface{}) error {
|
||||||
if outer, ok := w.(*encbuf); ok {
|
if outer, ok := w.(*encbuf); ok {
|
||||||
// Encode was called by some type's EncodeRLP.
|
// Encode was called by some type's EncodeRLP.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue