pub mod arrow;
pub trait StrTupleRef {
fn as_strs(&self) -> Vec<(&str, &str, &str)>;
}
impl StrTupleRef for Vec<(String, String, String)> {
fn as_strs(&self) -> Vec<(&str, &str, &str)> {
self.iter()
.map(|(s1, s2, s3)| (s1.as_str(), s2.as_str(), s3.as_str()))
.collect()
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_convert_vec_of_string_to_vec_of_str_slice() {
let vec_of_strings = vec![
(
String::from("date"),
String::from("="),
String::from("2022-01-02"),
),
(
String::from("foo"),
String::from("bar"),
String::from("baz"),
),
];
let binding = vec_of_strings.as_strs();
let str_slice = &binding[..];
assert_eq!(
str_slice,
[("date", "=", "2022-01-02"), ("foo", "bar", "baz")]
);
}
}