rust `?` couldn‘t convert the error to `std::string::String`the question mark operation (`?`) 📅 2026/6/28 6:11:04 rust 带?写法报错const CONFIG: Config Config { width: 80.0, height: 30.0, scale: 1.0, }; let json_str serde_json::to_string(size)?; println!(size: {}, json_str);? couldnt convert the error to std::string::Stringthe question mark operation (?) implicitly performs a conversion on the error value using the From traitthe following other types implement trait FromT:std::string::String implements Frommut strstd::string::String implements Fromstd::string::Stringstd::string::String implements Fromstrstd::string::String implements FromAssetKeystd::string::String implements FromBoxstr因为返回值类型带 Error 需要处理。改为下面写法通过。let json_str serde_json::to_string(size) .map_err(|err| err.to_string())?; println!(size: {}, json_str);