UnmarshalText satisfies the encoding.TextUnmarshaler interface
(text []byte)
| 20 | |
| 21 | // UnmarshalText satisfies the encoding.TextUnmarshaler interface |
| 22 | func (h *HexBytes) UnmarshalText(text []byte) error { |
| 23 | n := hex.DecodedLen(len(text)) |
| 24 | *h = make([]byte, n) |
| 25 | _, err := hex.Decode(*h, text) |
| 26 | return err |
| 27 | } |
| 28 | |
| 29 | // Map is a byte slice that should parse as a string encoding a JSON |
| 30 | // object. This is checked in UnmarshalJSON. |