pub struct EspAsyncTls<S>(/* private fields */)
where
S: PollableSocket;
Implementations§
Source§impl<S> EspAsyncTls<S>where
S: PollableSocket,
impl<S> EspAsyncTls<S>where
S: PollableSocket,
Sourcepub fn adopt(socket: S) -> Result<Self, EspError>
pub fn adopt(socket: S) -> Result<Self, EspError>
Create a new AsyncEspTls
instance adopting the supplied socket.
The socket should be in a connected state.
§Errors
ESP_ERR_NO_MEM
if not enough memory to create the TLS connection
Sourcepub async fn negotiate(
&mut self,
hostname: &str,
cfg: &Config<'_>,
) -> Result<CompletedHandshake, EspError>
pub async fn negotiate( &mut self, hostname: &str, cfg: &Config<'_>, ) -> Result<CompletedHandshake, EspError>
Establish a TLS/SSL connection using the adopted socket.
§Errors
ESP_ERR_INVALID_SIZE
ifcfg.alpn_protos
exceeds 9 elements or avg 10 bytes/ALPNESP_FAIL
if connection could not be established
Sourcepub async fn read(&self, buf: &mut [u8]) -> Result<usize, EspError>
pub async fn read(&self, buf: &mut [u8]) -> Result<usize, EspError>
Read in the supplied buffer. Returns the number of bytes read.
pub fn poll_read( &self, ctx: &mut Context<'_>, buf: &mut [u8], ) -> Poll<Result<usize, EspError>>
Sourcepub async fn write(&self, buf: &[u8]) -> Result<usize, EspError>
pub async fn write(&self, buf: &[u8]) -> Result<usize, EspError>
Write the supplied buffer. Returns the number of bytes written.
pub fn poll_write( &self, ctx: &mut Context<'_>, buf: &[u8], ) -> Poll<Result<usize, EspError>>
pub async fn write_all(&self, buf: &[u8]) -> Result<(), EspError>
pub fn context_handle(&self) -> *mut esp_tls
Trait Implementations§
Source§impl<S> AsyncRead for &EspAsyncTls<S>where
S: PollableSocket,
impl<S> AsyncRead for &EspAsyncTls<S>where
S: PollableSocket,
Source§impl<S> AsyncRead for EspAsyncTls<S>where
S: PollableSocket,
impl<S> AsyncRead for EspAsyncTls<S>where
S: PollableSocket,
Source§impl<S> AsyncWrite for &EspAsyncTls<S>where
S: PollableSocket,
impl<S> AsyncWrite for &EspAsyncTls<S>where
S: PollableSocket,
Source§fn poll_write(
self: Pin<&mut Self>,
ctx: &mut Context<'_>,
buf: &[u8],
) -> Poll<Result<usize>>
fn poll_write( self: Pin<&mut Self>, ctx: &mut Context<'_>, buf: &[u8], ) -> Poll<Result<usize>>
Attempt to write bytes from
buf
into the object. Read moreSource§fn poll_flush(self: Pin<&mut Self>, _ctx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_flush(self: Pin<&mut Self>, _ctx: &mut Context<'_>) -> Poll<Result<()>>
Attempt to flush the object, ensuring that any buffered data reach
their destination. Read more
Source§fn poll_close(self: Pin<&mut Self>, _ctx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_close(self: Pin<&mut Self>, _ctx: &mut Context<'_>) -> Poll<Result<()>>
Attempt to close the object. 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>>
Attempt to write bytes from
bufs
into the object using vectored
IO operations. Read moreSource§impl<S> AsyncWrite for EspAsyncTls<S>where
S: PollableSocket,
impl<S> AsyncWrite for EspAsyncTls<S>where
S: PollableSocket,
Source§fn poll_write(
self: Pin<&mut Self>,
ctx: &mut Context<'_>,
buf: &[u8],
) -> Poll<Result<usize>>
fn poll_write( self: Pin<&mut Self>, ctx: &mut Context<'_>, buf: &[u8], ) -> Poll<Result<usize>>
Attempt to write bytes from
buf
into the object. Read moreSource§fn poll_flush(self: Pin<&mut Self>, _ctx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_flush(self: Pin<&mut Self>, _ctx: &mut Context<'_>) -> Poll<Result<()>>
Attempt to flush the object, ensuring that any buffered data reach
their destination. Read more
Source§fn poll_close(self: Pin<&mut Self>, _ctx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_close(self: Pin<&mut Self>, _ctx: &mut Context<'_>) -> Poll<Result<()>>
Attempt to close the object. 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>>
Attempt to write bytes from
bufs
into the object using vectored
IO operations. Read moreSource§impl<S> ErrorType for EspAsyncTls<S>where
S: PollableSocket,
impl<S> ErrorType for EspAsyncTls<S>where
S: PollableSocket,
Source§type Error = EspIOError
type Error = EspIOError
Error type of all the IO operations on this type.
Source§impl<S> Read for EspAsyncTls<S>where
S: PollableSocket,
impl<S> Read for EspAsyncTls<S>where
S: PollableSocket,
Source§async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
Read some bytes from this source into the specified buffer, returning how many bytes were read. Read more
Source§async fn read_exact(
&mut self,
buf: &mut [u8],
) -> Result<(), ReadExactError<Self::Error>>
async fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>
Read the exact number of bytes required to fill
buf
. Read moreSource§impl<S> Write for EspAsyncTls<S>where
S: PollableSocket,
impl<S> Write for EspAsyncTls<S>where
S: PollableSocket,
Source§async fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>
async fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>
Write a buffer into this writer, returning how many bytes were written. Read more