dxfbin
Streaming text DXF to binary DXF converter.
Converts AutoCAD text-format DXF files to the binary DXF format without interpreting the drawing structure.
Each group code/value pair is read, typed according to the DXF group code specification, and written in its binary encoding.
The conversion is streaming and no_std-compatible.
Library usage
One-shot conversion from a byte slice:
use ;
let text_dxf = b" 0\nSECTION\n 2\nHEADER\n 0\nENDSEC\n 0\nEOF\n";
let mut out = Vecnew;
let mut sink = new;
convert_all.unwrap;
Streaming conversion via std::io::Read:
use StreamConverter;
use ;
let text_dxf = b" 0\nSECTION\n 2\nHEADER\n 0\nENDSEC\n 0\nEOF\n";
let mut converter = new;
let mut binary = Vecnew;
converter.read_to_end.unwrap;
Incremental feeding for custom buffering:
use ;
let mut converter = new;
let mut out = Vecnew;
let mut sink = new;
let chunk = b" 0\nEOF\n";
converter.feed.unwrap;
Typed sink
The [Sink] trait receives typed values (boolean, i16, i32, i64, f64, string, binary chunk) rather than raw bytes, so implementations can inspect or transform values by type.
no_std
[]
= { = "0.1", = false }
The std feature (on by default) adds the StreamConverter adapter.
CLI
The crate includes a dxfbin binary that reads text DXF from stdin and writes binary DXF to stdout:
License
ISC