MCPcopy Create free account
hub / github.com/dylan-sutton-chavez/edge-python / decode_str

Function decode_str

std/json/src/lib.rs:109–114  ·  view source on GitHub ↗
(h: &Handle, what: &str)

Source from the content-addressed store, hash-verified

107}
108
109fn 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}

Callers 1

dumpsFunction · 0.85

Calls 3

decodeFunction · 0.50
ValueEnum · 0.50
rawMethod · 0.45

Tested by

no test coverage detected