Skip to content

Commit

Permalink
rlp: add DecodeBytes
Browse files Browse the repository at this point in the history
Über-convenience.
  • Loading branch information
fjl committed Mar 18, 2015
1 parent cb009a5 commit b94a6a0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions rlp/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package rlp

import (
"bufio"
"bytes"
"encoding/binary"
"errors"
"fmt"
Expand Down Expand Up @@ -73,6 +74,12 @@ func Decode(r io.Reader, val interface{}) error {
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 {
msg string
typ reflect.Type
Expand Down

0 comments on commit b94a6a0

Please sign in to comment.