tokio_proto

Struct TcpClient

Source
pub struct TcpClient<Kind, P> { /* private fields */ }
Expand description

Builds client connections to external services.

To connect to a service, you need a client protocol implementation; see the crate documentation for guidance.

At the moment, this builder offers minimal configuration, but more will be added over time.

Implementations§

Source§

impl<Kind, P> TcpClient<Kind, P>
where P: BindClient<Kind, TcpStream>,

Source

pub fn new(protocol: P) -> TcpClient<Kind, P>

Create a builder for the given client protocol.

To connect to a service, you need a client protocol implementation; see the crate documentation for guidance.

Source

pub fn connect(&self, addr: &SocketAddr, handle: &Handle) -> Connect<Kind, P>

Establish a connection to the given address.

§Return value

Returns a future for the establishment of the connection. When the future completes, it yields an instance of Service for interacting with the server.

Trait Implementations§

Source§

impl<Kind: Debug, P: Debug> Debug for TcpClient<Kind, P>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<Kind, P> Freeze for TcpClient<Kind, P>

§

impl<Kind, P> RefUnwindSafe for TcpClient<Kind, P>
where Kind: RefUnwindSafe, P: RefUnwindSafe,

§

impl<Kind, P> Send for TcpClient<Kind, P>
where Kind: Send, P: Sync + Send,

§

impl<Kind, P> Sync for TcpClient<Kind, P>
where Kind: Sync, P: Sync + Send,

§

impl<Kind, P> Unpin for TcpClient<Kind, P>
where Kind: Unpin,

§

impl<Kind, P> UnwindSafe for TcpClient<Kind, P>
where Kind: UnwindSafe, P: RefUnwindSafe,

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, 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.