Lines
100 %
Functions
75 %
Branches
use crate::render::{WireValue, parse_wire};
use nomiscript::Value;
/// Parse a wire reply and return the value formatted as a string.
///
/// Used to surface query results (e.g. `convert`) on the status line
/// without exposing `nomiscript::Value` to calling crates.
pub fn parse_scalar_reply(wire: &str) -> Result<String, String> {
let value = parse_wire(wire).map_err(|e| e.to_string())?;
let WireValue::Value(v) = value;
Ok(match v {
Value::String(s) => s,
other => nomiscript::format_value_display(&other),
})
}