code: func (g *Generator) genTypeDecoder(t reflect.Type, out string, tags fieldTags, indent int) error {
  	ws := strings.Repeat("  ", indent)
  
  	unmarshalerIface := reflect.TypeOf((*easyjson.Unmarshaler)(nil)).Elem()
  	if reflect.PtrTo(t).Implements(unmarshalerIface) {
  		fmt.Fprintln(g.out, ws+"("+out+").UnmarshalEasyJSON(in)")
  		return nil
  	}
  
  	unmarshalerIface = reflect.TypeOf((*json.Unmarshaler)(nil)).Elem()
  	if reflect.PtrTo(t).Implements(unmarshalerIface) {
  		fmt.Fprintln(g.out, ws+"if data := in.Raw(); in.Ok() {")
  		fmt.Fprintln(g.out, ws+"  in.AddError( ("+out+").UnmarshalJSON(data) )")
  		fmt.Fprintln(g.out, ws+"}")
  		return nil
  	}
  
  	unmarshalerIface = reflect.TypeOf((*encoding.TextUnmarshaler)(nil)).Elem()
  	if reflect.PtrTo(t).Implements(unmarshalerIface) {
  		fmt.Fprintln(g.out, ws+"if data := in.UnsafeBytes(); in.Ok() {")
  		fmt.Fprintln(g.out, ws+"  in.AddError( ("+out+").UnmarshalText(data) )")
  		fmt.Fprintln(g.out, ws+"}")
  		return nil
  	}
  
  	err := g.genTypeDecoderNoCheck(t, out, tags, indent)
  	return err
  }
docs: // genTypeDecoder generates decoding code for the type t, but uses unmarshaler interface if implemented by t.