rustls::unbuffered

Enum ConnectionState

Source
#[non_exhaustive]
pub enum ConnectionState<'c, 'i, Data> { ReadTraffic(ReadTraffic<'c, 'i, Data>), Closed, ReadEarlyData(ReadEarlyData<'c, 'i, Data>), EncodeTlsData(EncodeTlsData<'c, Data>), TransmitTlsData(TransmitTlsData<'c, Data>), BlockedHandshake, WriteTraffic(WriteTraffic<'c, Data>), }
Expand description

The state of the UnbufferedConnectionCommon object

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

ReadTraffic(ReadTraffic<'c, 'i, Data>)

One, or more, application data records are available

See ReadTraffic for more details on how to use the enclosed object to access the received data.

§

Closed

Connection has been cleanly closed by the peer

§

ReadEarlyData(ReadEarlyData<'c, 'i, Data>)

One, or more, early (RTT-0) data records are available

§

EncodeTlsData(EncodeTlsData<'c, Data>)

A Handshake record is ready for encoding

Call EncodeTlsData::encode on the enclosed object, providing an outgoing_tls buffer to store the encoding

§

TransmitTlsData(TransmitTlsData<'c, Data>)

Previously encoded handshake records need to be transmitted

Transmit the contents of the outgoing_tls buffer that was passed to previous EncodeTlsData::encode calls to the peer.

After transmitting the contents, call TransmitTlsData::done on the enclosed object. The transmitted contents MUST not be sent to the peer more than once so they SHOULD be discarded at this point.

At some stages of the handshake process, it’s possible to send application-data alongside handshake records. Call TransmitTlsData::may_encrypt_app_data on the enclosed object to probe if that’s allowed.

§

BlockedHandshake

More TLS data is needed to continue with the handshake

Request more data from the peer and append the contents to the incoming_tls buffer that was passed to UnbufferedConnectionCommon::process_tls_records.

§

WriteTraffic(WriteTraffic<'c, Data>)

The handshake process has been completed.

WriteTraffic::encrypt can be called on the enclosed object to encrypt application data into an outgoing_tls buffer. Similarly, WriteTraffic::queue_close_notify can be used to encrypt a close_notify alert message into a buffer to signal the peer that the connection is being closed. Data written into outgoing_buffer by either method MAY be transmitted to the peer during this state.

Once this state has been reached, data MAY be requested from the peer and appended to an incoming_tls buffer that will be passed to a future UnbufferedConnectionCommon::process_tls_records invocation. When enough data has been appended to incoming_tls, UnbufferedConnectionCommon::process_tls_records will yield the ConnectionState::ReadTraffic state.

Trait Implementations§

Source§

impl<Data> Debug for ConnectionState<'_, '_, Data>

Source§

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

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

impl<'c, Data> From<EncodeTlsData<'c, Data>> for ConnectionState<'c, '_, Data>

Source§

fn from(v: EncodeTlsData<'c, Data>) -> Self

Converts to this type from the input type.
Source§

impl<'c, 'i, Data> From<ReadEarlyData<'c, 'i, Data>> for ConnectionState<'c, 'i, Data>

Source§

fn from(v: ReadEarlyData<'c, 'i, Data>) -> Self

Converts to this type from the input type.
Source§

impl<'c, 'i, Data> From<ReadTraffic<'c, 'i, Data>> for ConnectionState<'c, 'i, Data>

Source§

fn from(v: ReadTraffic<'c, 'i, Data>) -> Self

Converts to this type from the input type.
Source§

impl<'c, Data> From<TransmitTlsData<'c, Data>> for ConnectionState<'c, '_, Data>

Source§

fn from(v: TransmitTlsData<'c, Data>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'c, 'i, Data> Freeze for ConnectionState<'c, 'i, Data>

§

impl<'c, 'i, Data> !RefUnwindSafe for ConnectionState<'c, 'i, Data>

§

impl<'c, 'i, Data> Send for ConnectionState<'c, 'i, Data>
where Data: Send,

§

impl<'c, 'i, Data> Sync for ConnectionState<'c, 'i, Data>
where Data: Sync,

§

impl<'c, 'i, Data> Unpin for ConnectionState<'c, 'i, Data>

§

impl<'c, 'i, Data> !UnwindSafe for ConnectionState<'c, 'i, Data>

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

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 64 bytes

Size for each variant:

  • ReadTraffic: 56 bytes
  • Closed: 0 bytes
  • ReadEarlyData: 56 bytes
  • EncodeTlsData: 32 bytes
  • TransmitTlsData: 8 bytes
  • BlockedHandshake: 0 bytes
  • WriteTraffic: 8 bytes