aboutsummaryrefslogtreecommitdiffstats
path: root/src/yaml.rs
diff options
context:
space:
mode:
authorTeddy Wing2022-03-21 02:04:29 +0100
committerTeddy Wing2022-03-21 02:04:29 +0100
commit9816ad12c931e18ea7cc0e6cfaf3914a173e173e (patch)
treea03efc65717943382cbba21ae12e8161000eaba5 /src/yaml.rs
parent3f5c588dcc24c2d8a642f56694f68b1afa2207ea (diff)
downloadyaqlite-9816ad12c931e18ea7cc0e6cfaf3914a173e173e.tar.bz2
get_column_names(): Use `HashSet` instead of `HashMap`
This saves us from having to declare and use a vestigial unit struct value for the hash. In retrospect, I could have used the unit type instead of creating a unit struct, but this is even cleaner. Only a couple hours ago learned that `HashSet` exists.
Diffstat (limited to 'src/yaml.rs')
-rw-r--r--src/yaml.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/yaml.rs b/src/yaml.rs
index 9b0988c..af71779 100644
--- a/src/yaml.rs
+++ b/src/yaml.rs
@@ -1,7 +1,7 @@
use rusqlite;
use yaml_rust::yaml;
-use std::collections::HashMap;
+use std::collections::HashSet;
mod sql;
@@ -18,7 +18,7 @@ pub fn extract(
doc: &mut yaml::Yaml,
tx: &rusqlite::Transaction,
table_name: &str,
- table_columns: &HashMap<String, crate::sqlite::Zero>,
+ table_columns: &HashSet<String>,
) -> Result<(), crate::Error> {
match doc {
yaml::Yaml::Array(ref mut array) => {
@@ -30,7 +30,7 @@ pub fn extract(
use std::borrow::Cow;
let keys: Vec<yaml::Yaml> = hash.keys().map(|k| k.clone()).collect();
- let columns_as_yaml: Vec<yaml::Yaml> = table_columns.keys()
+ let columns_as_yaml: Vec<yaml::Yaml> = table_columns.iter()
.map(|c| yaml::Yaml::from_str(c))
.collect();