range display touchup

This commit is contained in:
JT 2021-10-26 11:24:10 +13:00
parent 4be61ce604
commit c18f0dcc84

View File

@ -167,17 +167,9 @@ impl Value {
Value::Filesize { val, .. } => format_filesize(val), Value::Filesize { val, .. } => format_filesize(val),
Value::Duration { val, .. } => format_duration(val), Value::Duration { val, .. } => format_duration(val),
Value::Date { val, .. } => HumanTime::from(val).to_string(), Value::Date { val, .. } => HumanTime::from(val).to_string(),
Value::Range { val, .. } => match val.into_range_iter() { Value::Range { val, .. } => {
Ok(iter) => { format!("{}..{}", val.from.into_string(), val.to.into_string())
format!( }
"range: [{}]",
iter.map(|x| x.into_string())
.collect::<Vec<String>>()
.join(", ")
)
}
Err(error) => format!("{:?}", error),
},
Value::String { val, .. } => val, Value::String { val, .. } => val,
Value::List { vals: val, .. } => format!( Value::List { vals: val, .. } => format!(
"[{}]", "[{}]",
@ -210,15 +202,9 @@ impl Value {
Value::Filesize { val, .. } => format!("{} bytes", val), Value::Filesize { val, .. } => format!("{} bytes", val),
Value::Duration { val, .. } => format!("{} ns", val), Value::Duration { val, .. } => format!("{} ns", val),
Value::Date { val, .. } => format!("{:?}", val), Value::Date { val, .. } => format!("{:?}", val),
Value::Range { val, .. } => match val.into_range_iter() { Value::Range { val, .. } => {
Ok(iter) => iter format!("{}..{}", val.from.into_string(), val.to.into_string())
.map(|x| x.into_string()) }
.collect::<Vec<String>>()
.join(", "),
Err(error) => {
format!("{:?}", error)
}
},
Value::String { val, .. } => val, Value::String { val, .. } => val,
Value::List { vals: val, .. } => val Value::List { vals: val, .. } => val
.into_iter() .into_iter()