from vcf from ics and from ini (#367)

* MathEval Variance and Stddev

* Fix tests and linting

* Typo

* Deal with streams when they are not tables

* `from toml` command

* From ods

* From XLSX

* From ics

* From ini

* From vcf

* Forgot a eprintln!
This commit is contained in:
Luccas Mateus
2021-11-25 14:10:56 -03:00
committed by GitHub
parent 6a1942b18f
commit 8043516d75
11 changed files with 722 additions and 29 deletions

View File

@ -6,6 +6,7 @@ mod unit;
use chrono::{DateTime, FixedOffset};
use chrono_humanize::HumanTime;
use indexmap::map::IndexMap;
pub use range::*;
use serde::{Deserialize, Serialize};
pub use stream::*;
@ -1320,6 +1321,23 @@ impl From<Spanned<HashMap<String, Value>>> for Value {
}
}
/// Create a Value::Record from a spanned indexmap
impl From<Spanned<IndexMap<String, Value>>> for Value {
fn from(input: Spanned<IndexMap<String, Value>>) -> Self {
let span = input.span;
let (cols, vals) = input
.item
.into_iter()
.fold((vec![], vec![]), |mut acc, (k, v)| {
acc.0.push(k);
acc.1.push(v);
acc
});
Value::Record { cols, vals, span }
}
}
/// Format a duration in nanoseconds into a string
pub fn format_duration(duration: i64) -> String {
let (sign, duration) = if duration >= 0 {