diff options
author | Felix Lange <fjl@twurst.com> | 2015-09-09 09:34:15 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-09-11 01:41:51 +0800 |
commit | 24bb68e7cf546153436f1d38a7227fdf75d73343 (patch) | |
tree | fa85e497a639af7aa8ad1cc83dc09fe104fbd7df /rlp/encode.go | |
parent | bc17dba8fba0f3007398f231f07916a95ed963ac (diff) | |
download | dexon-24bb68e7cf546153436f1d38a7227fdf75d73343.tar.gz dexon-24bb68e7cf546153436f1d38a7227fdf75d73343.tar.zst dexon-24bb68e7cf546153436f1d38a7227fdf75d73343.zip |
rlp: add RawValue
Diffstat (limited to 'rlp/encode.go')
-rw-r--r-- | rlp/encode.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/rlp/encode.go b/rlp/encode.go index a0531af01..2aeee4721 100644 --- a/rlp/encode.go +++ b/rlp/encode.go @@ -354,6 +354,8 @@ var ( func makeWriter(typ reflect.Type) (writer, error) { kind := typ.Kind() switch { + case typ == rawValueType: + return writeRawValue, nil case typ.Implements(encoderInterface): return writeEncoder, nil case kind != reflect.Ptr && reflect.PtrTo(typ).Implements(encoderInterface): @@ -389,6 +391,11 @@ func isByte(typ reflect.Type) bool { return typ.Kind() == reflect.Uint8 && !typ.Implements(encoderInterface) } +func writeRawValue(val reflect.Value, w *encbuf) error { + w.str = append(w.str, val.Bytes()...) + return nil +} + func writeUint(val reflect.Value, w *encbuf) error { i := val.Uint() if i == 0 { |