aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2022-03-19 19:33:04 +0100
committerTeddy Wing2022-03-19 19:33:04 +0100
commitc75a82361cb3566d196a1fb930ea4833f40b0ffd (patch)
tree7148314683f88365bfe372149e7d2ae4df21e6f9
parentff5bd6a0c5db4c8f62f37e1ea9ce8d53d8f453ef (diff)
downloadyaqlite-c75a82361cb3566d196a1fb930ea4833f40b0ffd.tar.bz2
main: Try to emit serialized YAML to standard output
Doesn't work this way as `YamlEmitter` requires `std::fmt::Write` instead of `std::io::Write` (implemented by `Stdout`). Looks like I'll need some kind of intermediary buffer or adapter to convert between the different `Write` traits.
-rw-r--r--src/main.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index 6c87a0b..7f372ea 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -79,7 +79,7 @@ fn main() {
} => {
let dbconn = rusqlite::Connection::open(database).unwrap();
- match primary_key {
+ let yaml_data = match primary_key {
Some(pk) => yaqlite::select_by_column(
&dbconn,
&table_name,
@@ -94,6 +94,11 @@ fn main() {
).unwrap(),
};
+ let mut emitter = yaml_rust::YamlEmitter::new(
+ &mut std::io::stdout().lock(),
+ );
+ emitter.dump(&yaml_data).unwrap();
+
dbconn.close().unwrap();
},
};