Expand description
High-level APIs for bidirectional conversions between DcMstring and external documents.
§Architecture
Document conversion in Collective Toolbox is organized around [DcMstring] as the
universal internal representation. Conversions are bidirectional:
- Import: Converts external document formats (e.g. UTF-8, DcText, Dcts, Dcal,
DcIntegerList,DcMixed, DcUtf, SEMS, Ascii,CscJournal) into [DcMstring]. - Export: Serializes a [
DcMstring] into any supported output format (SupportedDcOutputFormat).
§In-Memory Conversions
For whole documents in memory or files on disk:
convert_bytes_to_dcmstring: Parses raw bytes with optional format detection.convert_file_to_dcmstring: Reads a file from disk (or stdin) into a [DcMstring].convert_cscjournal_to_dcmstring: Converts legacy and v4+ cscjournal files to a [DcMstring].convert_dcmstring_to_bytes: Serializes [DcMstring] to target format bytes.convert_dcmstring_to_file: Writes [DcMstring] to a target format file or stdout.
§Streaming Conversions
For pipeline processing of documents and standard Unix pipelines:
stream_reader_to_dcmwriter: Streams an input source into framed.dcmmbytes.stream_file_to_dcmwriter: Streams a file on disk into framed.dcmmbytes.stream_dcmreader_to_writer: Streams framed.dcmmbytes into a target format.stream_dcmfile_to_writer: Streams a.dcmmfile into a target format writer.
§Format Detection
When FormatSpec::Auto is specified, format detection is delegated directly to
the authoritative format detection engine in [ctb_formats_detection].
§Diagnostics and Logs
All conversions return a [ctb_formats_utilities::FormatLog] containing warnings,
errors, and diagnostic notices generated during conversion.
Re-exports§
pub use crate::convert_bytes::DcConversionOptions;pub use crate::convert_bytes::DcConversionResult;pub use crate::convert_bytes::DcExportOptions;pub use crate::convert_bytes::DcExportResult;pub use crate::convert_bytes::FormatSpec;pub use crate::convert_bytes::convert_bytes_to_dcmstring;pub use crate::convert_bytes::convert_dcmstring_to_bytes;pub use crate::convert_bytes::convert_dcmstring_to_file;pub use crate::convert_bytes::convert_file_to_dcmstring;pub use crate::convert_stream::StreamConversionReceipt;pub use crate::convert_stream::StreamExportReceipt;pub use crate::convert_stream::stream_dcmfile_to_writer;pub use crate::convert_stream::stream_dcmreader_to_writer;pub use crate::convert_stream::stream_file_to_dcmwriter;pub use crate::convert_stream::stream_reader_to_dcmwriter;
Enums§
- DcNormalization
Mode - Policy for normalizing Document Characters and Unicode during conversion.
- Supported
DcInput Format - Document and text formats supported for conversion to Document Character String (DcMstring / DcString).
- Supported
DcOutput Format - Document and text formats supported for conversion from Document Character String (DcMstring / DcString).
- Supported
DcTransformation - Document Character (Dc) transformations supported by the workspace.
Functions§
- convert_
cscjournal_ to_ dcmstring - Converts any in-memory cscjournal bytes (legacy or v4+) to a
DcMstringdocument. - list_
supported_ input_ formats - Returns the ordered list of all supported input formats for conversion to
DcMstring. - list_
supported_ output_ formats - Returns the ordered list of all supported output formats for conversion from
DcMstring. - list_
supported_ transformations - Returns the ordered list of all supported document transformations.