pub trait TcpServerCallBack: Copy {
// Required methods
async fn conn<const CN: usize>(
&self,
endpoint: IpEndpoint,
wch: &WriteChannel<'_, CN>,
);
async fn dis_conn(&self, endpoint: IpEndpoint);
async fn recv<const CN: usize>(
&self,
endpoint: IpEndpoint,
buf: &[u8],
wch: &WriteChannel<'_, CN>,
);
async fn err(&self, err: SocketErr);
}Expand description
tcp server回调
Required Methods§
Sourceasync fn conn<const CN: usize>(
&self,
endpoint: IpEndpoint,
wch: &WriteChannel<'_, CN>,
)
async fn conn<const CN: usize>( &self, endpoint: IpEndpoint, wch: &WriteChannel<'_, CN>, )
有连接进来时回调此
Sourceasync fn dis_conn(&self, endpoint: IpEndpoint)
async fn dis_conn(&self, endpoint: IpEndpoint)
连接断开后的回调
Sourceasync fn recv<const CN: usize>(
&self,
endpoint: IpEndpoint,
buf: &[u8],
wch: &WriteChannel<'_, CN>,
)
async fn recv<const CN: usize>( &self, endpoint: IpEndpoint, buf: &[u8], wch: &WriteChannel<'_, CN>, )
数据读取
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.