Add to bencode.Unmarshal doc comment
This commit is contained in:
parent
b9c7d6266b
commit
364c7d862e
|
@ -127,8 +127,10 @@ func MustMarshal(v interface{}) []byte {
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unmarshal the bencode value in the 'data' to a value pointed by the 'v'
|
// Unmarshal the bencode value in the 'data' to a value pointed by the 'v' pointer, return a non-nil
|
||||||
// pointer, return a non-nil error if any.
|
// error if any. If there are trailing bytes, this results in ErrUnusedTrailingBytes, but the value
|
||||||
|
// will be valid. It's probably more consistent to use Decoder.Decode if you want to rely on this
|
||||||
|
// behaviour (inspired by Rust's serde here).
|
||||||
func Unmarshal(data []byte, v interface{}) (err error) {
|
func Unmarshal(data []byte, v interface{}) (err error) {
|
||||||
buf := bytes.NewReader(data)
|
buf := bytes.NewReader(data)
|
||||||
e := Decoder{r: buf}
|
e := Decoder{r: buf}
|
||||||
|
|
Loading…
Reference in New Issue