esp_idf_svc::tls

Struct EspAsyncTls

Source
pub struct EspAsyncTls<S>(/* private fields */)
where
    S: PollableSocket;

Implementations§

Source§

impl<S> EspAsyncTls<S>
where S: PollableSocket,

Source

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
Source

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 if cfg.alpn_protos exceeds 9 elements or avg 10 bytes/ALPN
  • ESP_FAIL if connection could not be established
Source

pub async fn read(&self, buf: &mut [u8]) -> Result<usize, EspError>

Read in the supplied buffer. Returns the number of bytes read.

Source

pub fn poll_read( &self, ctx: &mut Context<'_>, buf: &mut [u8], ) -> Poll<Result<usize, EspError>>

Source

pub async fn write(&self, buf: &[u8]) -> Result<usize, EspError>

Write the supplied buffer. Returns the number of bytes written.

Source

pub fn poll_write( &self, ctx: &mut Context<'_>, buf: &[u8], ) -> Poll<Result<usize, EspError>>

Source

pub async fn write_all(&self, buf: &[u8]) -> Result<(), EspError>

Source

pub fn context_handle(&self) -> *mut esp_tls

Trait Implementations§

Source§

impl<S> AsyncRead for &EspAsyncTls<S>
where S: PollableSocket,

Source§

fn poll_read( self: Pin<&mut Self>, ctx: &mut Context<'_>, buf: &mut [u8], ) -> Poll<Result<usize>>

Attempt to read from the AsyncRead into buf. Read more
Source§

fn poll_read_vectored( self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &mut [IoSliceMut<'_>], ) -> Poll<Result<usize, Error>>

Attempt to read from the AsyncRead into bufs using vectored IO operations. Read more
Source§

impl<S> AsyncRead for EspAsyncTls<S>
where S: PollableSocket,

Source§

fn poll_read( self: Pin<&mut Self>, ctx: &mut Context<'_>, buf: &mut [u8], ) -> Poll<Result<usize>>

Attempt to read from the AsyncRead into buf. Read more
Source§

fn poll_read_vectored( self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &mut [IoSliceMut<'_>], ) -> Poll<Result<usize, Error>>

Attempt to read from the AsyncRead into bufs using vectored IO operations. Read more
Source§

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

Attempt to write bytes from buf into the object. Read more
Source§

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<()>>

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

Attempt to write bytes from bufs into the object using vectored IO operations. Read more
Source§

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

Attempt to write bytes from buf into the object. Read more
Source§

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<()>>

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

Attempt to write bytes from bufs into the object using vectored IO operations. Read more
Source§

impl<S> ErrorType for EspAsyncTls<S>
where S: PollableSocket,

Source§

type Error = EspIOError

Error type of all the IO operations on this type.
Source§

impl<S> Read for EspAsyncTls<S>
where S: PollableSocket,

Source§

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

Read the exact number of bytes required to fill buf. Read more
Source§

impl<S> Write for EspAsyncTls<S>
where S: PollableSocket,

Source§

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
Source§

async fn flush(&mut self) -> Result<(), Self::Error>

Flush this output stream, ensuring that all intermediately buffered contents reach their destination.
Source§

async fn write_all(&mut self, buf: &[u8]) -> Result<(), Self::Error>

Write an entire buffer into this writer. Read more

Auto Trait Implementations§

§

impl<S> !Freeze for EspAsyncTls<S>

§

impl<S> !RefUnwindSafe for EspAsyncTls<S>

§

impl<S> !Send for EspAsyncTls<S>

§

impl<S> !Sync for EspAsyncTls<S>

§

impl<S> Unpin for EspAsyncTls<S>
where S: Unpin,

§

impl<S> UnwindSafe for EspAsyncTls<S>
where S: UnwindSafe,

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.