summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/dmtx_svg.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/examples/dmtx_svg.rs b/examples/dmtx_svg.rs
new file mode 100644
index 0000000..5a3915a
--- /dev/null
+++ b/examples/dmtx_svg.rs
@@ -0,0 +1,14 @@
+use iec16022::DataMatrix;
+use std::env::args_os;
+use std::os::unix::ffi::OsStringExt;
+
+fn main() {
+ let data = args_os()
+ .skip(1) // program name
+ .map(|arg| arg.into_vec())
+ .collect::<Vec<_>>()
+ .join(&b' ');
+ let dmtx = DataMatrix::encode(&data).unwrap();
+
+ print!("{}", dmtx.svg());
+}