rlp: add DecodeBytes
Über-convenience.
This commit is contained in:
parent
cb009a5c4d
commit
b94a6a0193
@ -2,6 +2,7 @@ package rlp
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
|
"bytes"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -73,6 +74,12 @@ func Decode(r io.Reader, val interface{}) error {
|
|||||||
return NewStream(r).Decode(val)
|
return NewStream(r).Decode(val)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DecodeBytes parses RLP data from b into val.
|
||||||
|
// Please see the documentation of Decode for the decoding rules.
|
||||||
|
func DecodeBytes(b []byte, val interface{}) error {
|
||||||
|
return NewStream(bytes.NewReader(b)).Decode(val)
|
||||||
|
}
|
||||||
|
|
||||||
type decodeError struct {
|
type decodeError struct {
|
||||||
msg string
|
msg string
|
||||||
typ reflect.Type
|
typ reflect.Type
|
||||||
|
Loading…
Reference in New Issue
Block a user