Assisted-by: GLM 5.3 Flash
This commit is contained in:
+17
@@ -80,6 +80,23 @@ The one-shot form of a configured `Decoder`: the same options as
|
||||
The zero value takes the defaults: unknown keys ignored, numbers evaluated
|
||||
as `int64` and `float64`, no size limit and the 10000-level nesting default.
|
||||
|
||||
### `func ParseAs[T any](data []byte) (T, error)`
|
||||
|
||||
The generic shorthand for `Unmarshal` with a destination variable:
|
||||
|
||||
```go
|
||||
cfg, err := interpres.ParseAs[Config](data)
|
||||
```
|
||||
|
||||
The zero `T` comes back with the error.
|
||||
|
||||
### `func NewSchema[T any]()`
|
||||
|
||||
Precompiles the codec for `T`: the struct schema both directions walk and the
|
||||
interface flags the decoder and encoder resolve through are built once and
|
||||
cached, so the first document pays the cost instead of the hot path. A `T`
|
||||
that is not a struct warms nothing.
|
||||
|
||||
## Documents
|
||||
|
||||
`Parse` returns a `Document`: the value tree together with what a map cannot
|
||||
|
||||
Reference in New Issue
Block a user