pub trait ClientConfig:
Send
+ Sync
+ 'static {
type Connection: Connection;
// Required methods
fn validate(&self) -> Result<(), TransportError>;
fn build_connection(
&self,
) -> impl Future<Output = Result<Self::Connection, TransportError>> + Send;
fn protocol_name(&self) -> &'static str;
}
Expand description
客户端配置trait - 用于类型安全的客户端连接
Required Associated Types§
type Connection: Connection
Required Methods§
Sourcefn validate(&self) -> Result<(), TransportError>
fn validate(&self) -> Result<(), TransportError>
验证配置的正确性
Sourcefn build_connection(
&self,
) -> impl Future<Output = Result<Self::Connection, TransportError>> + Send
fn build_connection( &self, ) -> impl Future<Output = Result<Self::Connection, TransportError>> + Send
构建连接实例
Sourcefn protocol_name(&self) -> &'static str
fn protocol_name(&self) -> &'static str
获取协议名称
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.