Skip to main content

DecodeString

Trait DecodeString 

Source
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§

Source

fn decode(&self) -> String

解码为 UTF-8 字符串,解码失败时 panic

Source

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".

Implementations on Foreign Types§

Source§

impl<const N: usize> DecodeString for &[i8; N]

Source§

impl<const N: usize> DecodeString for [i8; N]

Implementors§