1
0
mirror of https://github.com/json-iterator/go.git synced 2025-06-24 23:16:47 +02:00

expose ValEncoder & ValDecoder

This commit is contained in:
Tao Wen
2017-06-20 08:08:59 +08:00
parent aa01f57b7f
commit 14588726a1
3 changed files with 30 additions and 16 deletions

View File

@ -86,7 +86,7 @@ func Test_read_interface(t *testing.T) {
func Test_read_custom_interface(t *testing.T) {
should := require.New(t)
var val MyInterface
RegisterTypeDecoder("jsoniter.MyInterface", func(ptr unsafe.Pointer, iter *Iterator) {
RegisterTypeDecoderFunc("jsoniter.MyInterface", func(ptr unsafe.Pointer, iter *Iterator) {
*((*MyInterface)(ptr)) = MyString(iter.ReadString())
})
err := UnmarshalFromString(`"hello"`, &val)