Skip to main content

ClientConnect

Struct ClientConnect 

Source
pub struct ClientConnect { /* private fields */ }

Implementations§

Source§

impl ClientConnect

Source

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.

Source

pub async fn dispatch_request( &self, request: ClientRequest, ) -> Result<(), ClientError>

Dispatches the request.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V