pub struct Socket { /* private fields */ }
Expand description
Represents an outbound TCP connection from your Worker.
Implementations§
source§impl Socket
impl Socket
sourcepub async fn close(&mut self) -> Result<()>
pub async fn close(&mut self) -> Result<()>
Closes the TCP socket. Both the readable and writable streams are forcibly closed.
sourcepub async fn closed(&self) -> Result<()>
pub async fn closed(&self) -> Result<()>
This Future is resolved when the socket is closed and is rejected if the socket encounters an error.
sourcepub fn start_tls(self) -> Socket
pub fn start_tls(self) -> Socket
Upgrades an insecure socket to a secure one that uses TLS,
returning a new Socket. Note that in order to call this method,
you must set secure_transport
to StartTls
when initially
calling connect
to create the socket.
pub fn builder() -> ConnectionBuilder
Trait Implementations§
source§impl AsyncWrite for Socket
impl AsyncWrite for Socket
source§fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8]
) -> Poll<IoResult<usize>>
fn poll_write( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8] ) -> Poll<IoResult<usize>>
Attempt to write bytes from
buf
into the object. Read moresource§fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<IoResult<()>>
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<IoResult<()>>
Attempts to flush the object, ensuring that any buffered data reach
their destination. Read more
source§fn poll_shutdown(
self: Pin<&mut Self>,
cx: &mut Context<'_>
) -> Poll<IoResult<()>>
fn poll_shutdown( self: Pin<&mut Self>, cx: &mut Context<'_> ) -> Poll<IoResult<()>>
Initiates or attempts to shut down this writer, returning success when
the I/O connection has completely shut down. Read more
source§fn poll_write_vectored(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
bufs: &[IoSlice<'_>]
) -> Poll<Result<usize, Error>>
fn poll_write_vectored( self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &[IoSlice<'_>] ) -> Poll<Result<usize, Error>>
Like
poll_write
, except that it writes from a slice of buffers. Read moresource§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
Determines if this writer has an efficient
poll_write_vectored
implementation. Read moreimpl Send for Socket
impl Sync for Socket
Auto Trait Implementations§
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