monoio_client::tcp_client

Struct TcpConn

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

Methods from Deref<Target = TcpStream>§

Source

pub fn local_addr(&self) -> Result<SocketAddr, Error>

Return the local address that this stream is bound to.

Source

pub fn peer_addr(&self) -> Result<SocketAddr, Error>

Return the remote address that this stream is connected to.

Source

pub fn nodelay(&self) -> Result<bool, Error>

Get the value of the TCP_NODELAY option on this socket.

Source

pub fn set_nodelay(&self, nodelay: bool) -> Result<(), Error>

Set the value of the TCP_NODELAY option on this socket.

Source

pub fn set_tcp_keepalive( &self, time: Option<Duration>, interval: Option<Duration>, retries: Option<u32>, ) -> Result<(), Error>

Set the value of the SO_KEEPALIVE option on this socket.

Source

pub async fn readable(&self, relaxed: bool) -> Result<(), Error>

Wait for read readiness. Note: Do not use it before every io. It is different from other runtimes!

Everytime call to this method may pay a syscall cost. In uring impl, it will push a PollAdd op; in epoll impl, it will use use inner readiness state; if !relaxed, it will call syscall poll after that.

If relaxed, on legacy driver it may return false positive result. If you want to do io by your own, you must maintain io readiness and wait for io ready with relaxed=false.

Source

pub async fn writable(&self, relaxed: bool) -> Result<(), Error>

Wait for write readiness. Note: Do not use it before every io. It is different from other runtimes!

Everytime call to this method may pay a syscall cost. In uring impl, it will push a PollAdd op; in epoll impl, it will use use inner readiness state; if !relaxed, it will call syscall poll after that.

If relaxed, on legacy driver it may return false positive result. If you want to do io by your own, you must maintain io readiness and wait for io ready with relaxed=false.

Trait Implementations§

Source§

impl Debug for TcpConn

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Deref for TcpConn

Source§

type Target = TcpStream

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for TcpConn

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl Multiplex for TcpConn

Source§

fn is_multiplexed(&self) -> bool

Should return True
Source§

fn fork_connection(&self) -> Option<Self>
where Self: Sized,

Creates a new connection to the underlying multiplexed connection

Auto Trait Implementations§

§

impl !Freeze for TcpConn

§

impl !RefUnwindSafe for TcpConn

§

impl !Send for TcpConn

§

impl !Sync for TcpConn

§

impl Unpin for TcpConn

§

impl !UnwindSafe for TcpConn

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.