pub struct ServerBuilder { /* private fields */ }Expand description
Implementations§
Source§impl ServerBuilder
impl ServerBuilder
Sourcepub fn with_authenticator(self, authenticator: Arc<dyn Authenticator>) -> Self
pub fn with_authenticator(self, authenticator: Arc<dyn Authenticator>) -> Self
Sourcepub fn enable_auth(self) -> Self
pub fn enable_auth(self) -> Self
启用认证
Sourcepub fn with_auth_timeout(self, timeout: Duration) -> Self
pub fn with_auth_timeout(self, timeout: Duration) -> Self
设置认证超时时间
Sourcepub fn on_message<F>(self, handler: F) -> Self
pub fn on_message<F>(self, handler: F) -> Self
Sourcepub fn on_connect<F>(self, handler: F) -> Self
pub fn on_connect<F>(self, handler: F) -> Self
Sourcepub fn on_disconnect<F>(self, handler: F) -> Self
pub fn on_disconnect<F>(self, handler: F) -> Self
Sourcepub fn with_protocol(self, protocol: TransportProtocol) -> Self
pub fn with_protocol(self, protocol: TransportProtocol) -> Self
设置传输协议
Sourcepub fn with_protocols(self, protocols: Vec<TransportProtocol>) -> Self
pub fn with_protocols(self, protocols: Vec<TransportProtocol>) -> Self
启用多协议监听
Sourcepub fn with_max_connections(self, max: usize) -> Self
pub fn with_max_connections(self, max: usize) -> Self
设置最大连接数
Sourcepub fn with_handshake_timeout(self, timeout: Duration) -> Self
pub fn with_handshake_timeout(self, timeout: Duration) -> Self
设置握手超时时间
Sourcepub fn with_max_handshake_concurrency(self, max: usize) -> Self
pub fn with_max_handshake_concurrency(self, max: usize) -> Self
设置最大并发握手数
Sourcepub fn with_write_timeout(self, timeout: Duration) -> Self
pub fn with_write_timeout(self, timeout: Duration) -> Self
设置单次连接写入超时时间
Sourcepub fn with_fanout_concurrency(self, max: usize) -> Self
pub fn with_fanout_concurrency(self, max: usize) -> Self
设置 fanout 发送最大并发度
Sourcepub fn with_heartbeat(self, heartbeat: HeartbeatConfig) -> Self
pub fn with_heartbeat(self, heartbeat: HeartbeatConfig) -> Self
设置心跳配置
Sourcepub fn with_default_format(self, format: SerializationFormat) -> Self
pub fn with_default_format(self, format: SerializationFormat) -> Self
设置默认序列化格式(用于协商,默认 Protobuf)
Sourcepub fn with_default_compression(self, compression: CompressionAlgorithm) -> Self
pub fn with_default_compression(self, compression: CompressionAlgorithm) -> Self
设置默认压缩算法(用于协商,默认 None)
Sourcepub fn build(self) -> Result<SimpleServer>
pub fn build(self) -> Result<SimpleServer>
Auto Trait Implementations§
impl !RefUnwindSafe for ServerBuilder
impl !UnwindSafe for ServerBuilder
impl Freeze for ServerBuilder
impl Send for ServerBuilder
impl Sync for ServerBuilder
impl Unpin for ServerBuilder
impl UnsafeUnpin for ServerBuilder
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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