pub trait DecodeString {
// Required methods
fn decode(&self) -> String;
fn try_decode(&self) -> Result<String, String>;
}Expand description
将 CTP 的 [i8; N] 字段(GB18030 编码)解码为 Rust UTF-8 字符串。
与 WrapToString 功能相同,但方法名不与 std::string::ToString 冲突。
Required Methods§
Sourcefn try_decode(&self) -> Result<String, String>
fn try_decode(&self) -> Result<String, String>
尝试解码为 UTF-8 字符串,解码失败时返回 Err
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".