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<(), 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 async fn write(&self, buf: &[u8]) -> Result<usize, EspError>

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

source

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

Trait Implementations§

source§

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

§

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