跳到主要内容

ConnectionState

枚举 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>), }
展开描述

此 state of the UnbufferedConnectionCommon object

变体 (Non-exhaustive)§

This enum is marked as non-exhaustive
非穷尽枚举未来可能添加新的变体。因此,在对非穷尽枚举的变体进行模式匹配时,必须额外增加一个通配符分支以涵盖未来的新变体。
§

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

One, 或 more, application data records are available

,请参见ReadTraffic 用于 more details on how 到 use the enclosed object 到 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 数据 received 从 the peer, meaning you can be sure you have received all 数据 the peer sent.

No further application data , received 从 the peer, so no further ReadTraffic states , produced.

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

§

Closed

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

This 是 terminal state. No other states , produced 用于 this connection.

§

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

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

§

EncodeTlsData(EncodeTlsData<'c, Data>)

A Handshake record is ready 用于 encoding

Call EncodeTlsData::encode on the enclosed object, providing an outgoing_tls 缓冲区 到 store the encoding

§

TransmitTlsData(TransmitTlsData<'c, Data>)

Previously encoded handshake records need 到 be transmitted

Transmit the contents of the outgoing_tls 缓冲区 that was passed 到 previous EncodeTlsData::encode calls 到 the peer.

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

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

§

BlockedHandshake

More TLS data is needed 到 continue with the handshake

Request more data 从 the peer 并 append the contents 到 the incoming_tls 缓冲区 that was passed 到 UnbufferedConnectionCommon::process_tls_records

§

WriteTraffic(WriteTraffic<'c, Data>)

此 handshake process has been completed.

WriteTraffic::encrypt can be called on the enclosed object 到 encrypt application data into an outgoing_tls 缓冲区. Similarly, WriteTraffic::queue_close_notify can be 用 到 encrypt 一个 close_notify alert message into 缓冲区 到 signal the peer that the connection is being closed. Data written into outgoing_buffer by either method MAY be transmitted 到 the peer during this state.

Once this state has been reached, data MAY be requested 从 the peer 并 appended 到 an incoming_tls 缓冲区 that , passed 到 一个 future UnbufferedConnectionCommon::process_tls_records invocation. When enough data has been appended 到 incoming_tls, UnbufferedConnectionCommon::process_tls_records will yield the ConnectionState::ReadTraffic state.

Trait 实现§

Source§

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

Source§

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

使用给定的格式化器格式化此值。 更多信息
Source§

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

Source§

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

从输入类型转换为此类型。
Source§

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

Source§

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

从输入类型转换为此类型。
Source§

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

Source§

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

从输入类型转换为此类型。
Source§

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

Source§

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

从输入类型转换为此类型。

自动 Trait 实现§

§

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

§

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

Blanket 实现§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. 更多信息
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows 从 an owned value. 更多信息
Source§

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

Source§

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

Mutably borrows 从 an owned value. 更多信息
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

原样返回传入的参数。

Source§

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

Source§

fn into(self) -> U

Calls U::从(self)

That is, this conversion is whatever the implementation of From<T> 用于 U 的实现方式。

Source§

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

Source§

type Error = Infallible

转换出错时返回的类型。
Source§

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

执行转换。
Source§

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

Source§

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

转换出错时返回的类型。
Source§

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

执行转换。