[−][src]Struct kcpserver::KcpListener
KcpListener 整个KCP 服务的入口点 config 存放KCP 配置 S是用户逻辑上下文类型
Implementations
impl<S, R> KcpListener<S, R> where
S: Send + 'static,
R: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static,
[src]
S: Send + 'static,
R: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static,
pub async fn new<A: ToSocketAddrs>(
addr: A,
config: KcpConfig,
drop_timeout_second: i64
) -> Result<Arc<Self>, Box<dyn Error>>
[src]
addr: A,
config: KcpConfig,
drop_timeout_second: i64
) -> Result<Arc<Self>, Box<dyn Error>>
创建一个KCPListener addr 监听的本地地址:端口 config 是KCP的配置
pub fn set_buff_input(
&self,
f: impl Fn(Arc<KcpPeer<S>>, Bytes) -> R + 'static + Send + Sync
)
[src]
&self,
f: impl Fn(Arc<KcpPeer<S>>, Bytes) -> R + 'static + Send + Sync
)
设置数据表输入函数
pub async fn set_kcpdrop_event_input<'_>(&'_ self, f: fn(_: u32))
[src]
设置KCP_PEER 清理事件
pub async fn start<'_>(&'_ self) -> Result<(), Box<dyn Error>>
[src]
启动服务
Trait Implementations
impl<S, R> Send for KcpListener<S, R> where
S: Send + 'static,
R: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static,
[src]
S: Send + 'static,
R: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static,
impl<S, R> Sync for KcpListener<S, R> where
S: Send + 'static,
R: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static,
[src]
S: Send + 'static,
R: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static,
Auto Trait Implementations
impl<S, R> !RefUnwindSafe for KcpListener<S, R>
impl<S, R> Unpin for KcpListener<S, R>
impl<S, R> !UnwindSafe for KcpListener<S, R>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,