(h: &Handle, what: &str)
| 107 | } |
| 108 | |
| 109 | fn decode_str(h: &Handle, what: &str) -> Result<String> { |
| 110 | match decode(h.raw())? { |
| 111 | Value::Bytes(b) => String::from_utf8(b).map_err(|e| Error::Value(alloc::format!("{} not UTF-8: {}", what, e))), |
| 112 | _ => Err(Error::Type(alloc::format!("{} must be str", what))), |
| 113 | } |
| 114 | } |