update dependencies to work with update eth-block-extractor

This commit is contained in:
Ian Norden
2019-12-02 13:24:49 -06:00
parent 31a9017c4f
commit d702cb720c
3000 changed files with 433987 additions and 182448 deletions
+50
View File
@@ -0,0 +1,50 @@
package refmt
import (
"github.com/polydawn/refmt/obj"
"github.com/polydawn/refmt/obj/atlas"
"github.com/polydawn/refmt/shared"
)
func Clone(src, dst interface{}) error {
return CloneAtlased(src, dst, atlas.MustBuild())
}
func MustClone(src, dst interface{}) {
if err := Clone(src, dst); err != nil {
panic(err)
}
}
func CloneAtlased(src, dst interface{}, atl atlas.Atlas) error {
return NewCloner(atl).Clone(src, dst)
}
func MustCloneAtlased(src, dst interface{}, atl atlas.Atlas) {
if err := CloneAtlased(src, dst, atl); err != nil {
panic(err)
}
}
type Cloner interface {
Clone(src, dst interface{}) error
}
func NewCloner(atl atlas.Atlas) Cloner {
x := &cloner{
marshaller: obj.NewMarshaller(atl),
unmarshaller: obj.NewUnmarshaller(atl),
}
x.pump = shared.TokenPump{x.marshaller, x.unmarshaller}
return x
}
type cloner struct {
marshaller *obj.Marshaller
unmarshaller *obj.Unmarshaller
pump shared.TokenPump
}
func (c cloner) Clone(src, dst interface{}) error {
c.marshaller.Bind(src)
c.unmarshaller.Bind(dst)
return c.pump.Run()
}