Expand description
Runtime codec selection by file extension or name.
Returns an Arc<dyn Codec>
so a caller (a file sink, a document loader) can pick a codec at runtime from a path’s extension without knowing the concrete type.
Only the codecs compiled in are selectable: the TOML codec requires the default-on toml feature;
JSON is always available.
Functions§
- codec_
for_ name - Return a codec for a lowercase format
name(for example"toml","json"), orNonewhen no compiled-in codec matches. - codec_
for_ path - Return a codec for
path’s file extension, orNonewhen the extension is missing or unrecognized.