From 62310caa32afe8d456d93ea4370b00f6ef2e8556 Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Fri, 21 Jun 2019 19:52:15 +1200 Subject: [PATCH] now tableview forces being a table --- src/format/table.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/format/table.rs b/src/format/table.rs index 8a62b53a0c..d3b585c7a1 100644 --- a/src/format/table.rs +++ b/src/format/table.rs @@ -13,13 +13,24 @@ pub struct TableView { } impl TableView { + fn merge_descriptors(values: &[Value]) -> Vec { + let mut ret = vec![]; + for value in values { + for desc in value.data_descriptors() { + if !ret.contains(&desc) { + ret.push(desc); + } + } + } + ret + } + pub fn from_list(values: &[Value]) -> Option { if values.len() == 0 { return None; } - let item = &values[0]; - let headers = item.data_descriptors(); + let headers = TableView::merge_descriptors(values); if headers.len() == 0 { return None;