Skip to content

Commit 0805d99

Browse files
committed
doc: update comments
1 parent 8a945ba commit 0805d99

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

decoder.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,9 @@ func (d *Decoder) Register(f any) {
321321
}
322322

323323
// WithUnmarshalers sets the provided Unmarshalers for the decoder.
324+
//
325+
// WithUnmarshalers is based on the encoding/json proposal:
326+
// https://github.com/golang/go/issues/5901.
324327
func (d *Decoder) WithUnmarshalers(u *Unmarshalers) {
325328
d.funcMap = u.funcMap
326329
d.ifaceFuncs = u.ifaceFuncs
@@ -580,6 +583,9 @@ func indirect(v reflect.Value) reflect.Value {
580583
}
581584

582585
// Unmarshalers stores custom unmarshal functions. Unmarshalers is immutable.
586+
//
587+
// Unmarshalers are based on the encoding/json proposal:
588+
// https://github.com/golang/go/issues/5901.
583589
type Unmarshalers struct {
584590
funcMap map[reflect.Type]func([]byte, any) error
585591
ifaceFuncs []ifaceDecodeFunc

encoder.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,10 @@ func (enc *Encoder) SetHeader(header []string) {
205205
enc.header = cp
206206
}
207207

208+
// WithMarshalers sets the provided Marshalers for the encoder.
209+
//
210+
// WithMarshalers are based on the encoding/json proposal:
211+
// https://github.com/golang/go/issues/5901.
208212
func (enc *Encoder) WithMarshalers(m *Marshalers) {
209213
enc.funcMap = m.funcMap
210214
enc.ifaceFuncs = m.ifaceFuncs
@@ -420,6 +424,9 @@ func (e *Encoder) cache(typ reflect.Type) ([]encField, []byte, []int, []string,
420424
}
421425

422426
// Marshalers stores custom unmarshal functions. Marshalers are immutable.
427+
//
428+
// Marshalers are based on the encoding/json proposal:
429+
// https://github.com/golang/go/issues/5901.
423430
type Marshalers struct {
424431
funcMap map[reflect.Type]marshalFunc
425432
ifaceFuncs []marshalFunc

0 commit comments

Comments
 (0)