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

@@ -10,6 +10,7 @@ thiserror = "1.0.29"
miette = "3.0.0"
serde = {version = "1.0.130", features = ["derive"]}
chrono = { version="0.4.19", features=["serde"] }
indexmap = { version="1.7", features=["serde-1"] }
chrono-humanize = "0.2.1"
byte-unit = "4.0.9"
im = "15.0.0"

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 {