Skip to content

Version 0.2.0

Compare
Choose a tag to compare
@jcrist jcrist released this 25 Feb 20:41
Add `default` callback to `encode`/`Encoder`

Adds a `default` callback kwarg to `Encoder` constructor and `encode`
function. This takes a callable that's called for all unsupported types
to optionally convert them into supported types (or error if
unsupported). This is useful for lazily coercing possibly unsupported
types into a supported representation.

Also fixes a bug in the `Encoder` dealloc, and moves the `type` kwarg to
`msgspec.decode` to a keyword-only kwarg.