mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 13:36:07 +02:00
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:
@ -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 {
|
||||
|
Reference in New Issue
Block a user