pub struct ClientConfig {
pub host: String,
pub port: u16,
pub user: String,
pub password: String,
pub app_name: String,
pub os_name: String,
pub timeout: Duration,
pub auto_reconnect: bool,
pub send_delay: Duration,
pub encoding: Option<String>,
}Expand description
客户端配置。
Fields§
§host: String§port: u16§user: String§password: String§app_name: String§os_name: String§timeout: Duration连接/读写超时
auto_reconnect: bool断线自动重连
send_delay: Duration每帧发送后的间隔(Rust 端单帧 write_all + TCP_NODELAY,默认 0 即可; 若遇帧合并问题可设 send_delay_ms 恢复间隔)
encoding: Option<String>服务器字符集。None=连接握手时自动检测(响应偏移 28:1=UTF8, 2=EUCKR, 其他=GB18030);也可手动指定 “GB18030”/“UTF-8”/“EUC-KR” 覆盖检测。 默认自动检测——服务器为 UTF-8 而按 GB18030 编解码是中文乱码的根因。
Trait Implementations§
Source§impl Clone for ClientConfig
impl Clone for ClientConfig
Source§impl Debug for ClientConfig
impl Debug for ClientConfig
Auto Trait Implementations§
impl Freeze for ClientConfig
impl RefUnwindSafe for ClientConfig
impl Send for ClientConfig
impl Sync for ClientConfig
impl Unpin for ClientConfig
impl UnsafeUnpin for ClientConfig
impl UnwindSafe for ClientConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more