Enum ConnectionState

Source
#[non_exhaustive]
pub enum ConnectionState<'c, 'i, Data> { ReadTraffic(ReadTraffic<'c, 'i, Data>), PeerClosed, Closed, ReadEarlyData(ReadEarlyData<'c, 'i, Data>), EncodeTlsData(EncodeTlsData<'c, Data>), TransmitTlsData(TransmitTlsData<'c, Data>), BlockedHandshake, WriteTraffic(WriteTraffic<'c, Data>), }
Available on crate feature net only.
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.

ยง

PeerClosed

Connection has been cleanly closed by the peer.

This state is encountered at most once by each connection โ€“ it is โ€œedgeโ€ triggered, rather than โ€œlevelโ€ triggered.

It delimits the data received from the peer, meaning you can be sure you have received all the data the peer sent.

No further application data will be received from the peer, so no further ReadTraffic states will be produced.

However, it is possible to send further application data via WriteTraffic states, or close the connection cleanly by calling WriteTraffic::queue_close_notify().

ยง

Closed

Connection has been cleanly closed by both us and the peer.

This is a terminal state. No other states will be produced for this connection.

ยง

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

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>) -> ConnectionState<'c, '_, Data>

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>) -> ConnectionState<'c, 'i, Data>

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>) -> ConnectionState<'c, 'i, Data>

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>) -> ConnectionState<'c, '_, Data>

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> Instrument for T

Sourceยง

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Sourceยง

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoRequest<T> for T

Sourceยง

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Sourceยง

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

Sourceยง

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Sourceยง

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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.
Sourceยง

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Sourceยง

fn vzip(self) -> V

Sourceยง

impl<T> WithSubscriber for T

Sourceยง

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Sourceยง

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Sourceยง

impl<T> ErasedDestructor for T
where T: 'static,