pub struct ClientConnect { /* private fields */ }Implementations§
Source§impl ClientConnect
impl ClientConnect
Sourcepub async fn new<C: Encoder<Bytes, Error = Error> + Decoder<Item = BytesMut, Error = Error> + Clone + Send + Sync + 'static + TfCodec>(
server_name: String,
connection_dest: String,
processor: Option<TrafficProcessorHolder<C>>,
codec: C,
client_config: Option<ClientConfig>,
max_request_in_time: usize,
) -> Result<Self, ClientError>
pub async fn new<C: Encoder<Bytes, Error = Error> + Decoder<Item = BytesMut, Error = Error> + Clone + Send + Sync + 'static + TfCodec>( server_name: String, connection_dest: String, processor: Option<TrafficProcessorHolder<C>>, codec: C, client_config: Option<ClientConfig>, max_request_in_time: usize, ) -> Result<Self, ClientError>
Creates and connect to the designated server address ‘server_name’ used for tls mode. You need to pass domain name of the server. If there is no tls, you can pass random data or empty ‘connection_dest’ the (server address/domain name):port. E.g temp_domain.com:443, or 65.88.95.127:9090. ‘processor’ the traffic processor, must be symmetric to the server one processor. ‘codec’ the connection codec. Recommended base LengthDelimitedCodec from module codec. ‘client_config’ the tls config. ‘max_request_in_time’ max amount of requests that can be dispatched in the same time.
Sourcepub async fn dispatch_request(
&self,
request: ClientRequest,
) -> Result<(), ClientError>
pub async fn dispatch_request( &self, request: ClientRequest, ) -> Result<(), ClientError>
Dispatches the request.
Auto Trait Implementations§
impl Freeze for ClientConnect
impl RefUnwindSafe for ClientConnect
impl Send for ClientConnect
impl Sync for ClientConnect
impl Unpin for ClientConnect
impl UnwindSafe for ClientConnect
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