Skip to main content

Module select

Module select 

Source
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"), or None when no compiled-in codec matches.
codec_for_path
Return a codec for path’s file extension, or None when the extension is missing or unrecognized.