Assisted-by: GLM 5.3 Flash
This commit is contained in:
+10
@@ -158,6 +158,11 @@ out, err := interpres.Marshal(cfg)
|
||||
The cancellable variant of `Marshal`. The context is checked before any work
|
||||
and every 64 fields during the reflection walk.
|
||||
|
||||
### `func MarshalAppend(buf []byte, v any) ([]byte, error)`
|
||||
|
||||
Appends the TOML encoding of `v` to `buf` and returns the extended buffer, the
|
||||
shape `json.MarshalAppend` has. A failed encoding leaves `buf` untouched.
|
||||
|
||||
## Decoding
|
||||
|
||||
### Value mapping
|
||||
@@ -282,6 +287,11 @@ destination is a slice, each element decodes into the slice's element type
|
||||
(`[]struct` or `[]map[string]V`); a mismatch on one element surfaces as an
|
||||
error wrapped with `[i]:` and the element index.
|
||||
|
||||
A value array also decodes into a fixed-size array, `[N]T`, the mirror of the
|
||||
encoder's ability to encode one. The element count has to match: an array
|
||||
whose length differs from `N` is an error, `interpres: cannot assign 2
|
||||
elements to [3]int`, wrapped with the key path.
|
||||
|
||||
### Custom decoding: `Unmarshaler`
|
||||
|
||||
A type that wants full control of its decode implements:
|
||||
|
||||
Reference in New Issue
Block a user