Assisted-by: GLM 5.3 Flash
This commit is contained in:
+16
-2
@@ -73,6 +73,13 @@ if err := interpres.Valid(data); err != nil {
|
||||
}
|
||||
```
|
||||
|
||||
### `func UnmarshalWithOptions(data []byte, v any, opts DecodeOptions) error`
|
||||
|
||||
The one-shot form of a configured `Decoder`: the same options as
|
||||
`NewDecoder` sets, in a `DecodeOptions` struct, applied to a single call.
|
||||
The zero value takes the defaults: unknown keys ignored, numbers evaluated
|
||||
as `int64` and `float64`, no size limit and the 10000-level nesting default.
|
||||
|
||||
## Documents
|
||||
|
||||
`Parse` returns a `Document`: the value tree together with what a map cannot
|
||||
@@ -443,6 +450,11 @@ different top-level value fails:
|
||||
| a nil `any` | `interpres: cannot marshal nil value` |
|
||||
| a nil pointer | `interpres: cannot marshal nil pointer` |
|
||||
|
||||
The encoding walk carries a nesting limit of 10000 levels, the parser's own
|
||||
figure: a value that nests deeper, which cyclic data always does, is rejected
|
||||
with an error that names the limit and suggests the cycle, instead of running
|
||||
the stack out.
|
||||
|
||||
### Field matching
|
||||
|
||||
Struct fields become TOML keys as follows:
|
||||
@@ -739,9 +751,11 @@ same way.
|
||||
### `type Decoder`
|
||||
|
||||
Configurable strictness for decoding, constructed with `NewDecoder`. Set up
|
||||
with `DisallowUnknownFields`, then call `Decode` or `DecodeContext` any number
|
||||
with the chainable methods, then call `Decode` or `DecodeContext` any number
|
||||
of times. A configured `Decoder` holds no per-call state and is safe for
|
||||
concurrent use.
|
||||
concurrent use. For a single document, `UnmarshalWithOptions(data, v,
|
||||
DecodeOptions{...})` sets the same options without the Decoder; its zero
|
||||
value takes the defaults.
|
||||
|
||||
| Method | Default | Effect |
|
||||
|---|---|---|
|
||||
|
||||
Reference in New Issue
Block a user