aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/aft-demo.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/aft-demo.rs')
-rw-r--r--src/bin/aft-demo.rs35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/bin/aft-demo.rs b/src/bin/aft-demo.rs
new file mode 100644
index 0000000..9a680c1
--- /dev/null
+++ b/src/bin/aft-demo.rs
@@ -0,0 +1,35 @@
+
+/*
+ * Writes example aft to stdout
+ */
+
+fn main() {
+
+ /*
+ * Sepal length Sepal width Petal length Petal width Species
+ * 5.1 3.5 1.4 0.2 I. setosa
+ * 4.9 3.0 1.4 0.2 I. setosa
+ * 4.7 3.2 1.3 0.2 I. setosa
+ * 4.6 3.1 1.5 0.2 I. setosa
+ * 5.0 3.6 1.4 0.2 I. setosa
+ */
+
+ // start header
+ print!("\x01");
+
+ // colum names
+ println!("{}", ["Sepal length", "Speal width", "Petal length", "Petal width", "Species"].join("\x1E"));
+
+ // colum types
+ println!("{}", ["float", "float", "float", "float", "str"].join("\x1E"));
+
+ // end header / start table
+ print!("\x02");
+
+ // print rows
+ println!("{}", ["5.1", "3.5", "1.4", "0.2", "I. setosa"].join("\x1E"));
+ println!("{}", ["4.9", "3.0", "1.4", "0.2", "I. setosa"].join("\x1E"));
+ println!("{}", ["4.7", "3.2", "1.3", "0.2", "I. setosa"].join("\x1E"));
+ println!("{}", ["4.6", "3.1", "1.5", "0.2", "I. setosa"].join("\x1E"));
+ println!("{}", ["5.0", "3.6", "1.4", "0.2", "I. setosa"].join("\x1E"));
+}