pub enum ReceiveTrafficState<'a, Side: SideData> {
ReadMore(ReceiveTraffic<Side>),
FlushSender(FlushSender<Side>),
Available(ReceivedApplicationData<'a, Side>),
CloseNotify,
}Expand description
A state machine that cycles between requiring further received TLS data and discharging received application data.
Each call to ReceiveTraffic::read() returns one of these states, and each
non-terminal state lets you obtain the next one: ReadMore by supplying more
input and calling read() again, and FlushSender / Available
through their into_next() methods. CloseNotify is terminal.
╭────────────────╮
╭───────▶│ ReceiveTraffic │
│ ╰───────┬────────╯
ReadMore │ read(&mut input)
│ ▼
╰────╭───────────────────────╮
│ ReceiveTrafficState │──── CloseNotify ────▶ (terminal)
╭───▶╰──┬────────────────────╯
│ │ │
│ FlushSender Available
│ .into_next() .into_next()
│ │ │
╰───────┴──────────────╯ReadMore: more TLS input is required. The variant holds theReceiveTraffic; collect more input and callread()on it again.FlushSender: receiving may have produced data to send. Make a note to perform IO with the matchingSendTraffic, and then callFlushSender::into_next()for the next state.Available: application data was received. Read it viaReceivedApplicationData::data(), then callReceivedApplicationData::into_next(): this discards the consumed input and returns the next state.CloseNotify: the peer closed the receive direction cleanly. Terminal.
Variants§
ReadMore(ReceiveTraffic<Side>)
More input is required.
Collect it into your input buffer, and then call ReceiveTraffic::read() again.
FlushSender(FlushSender<Side>)
The sender may have new data to send.
Available(ReceivedApplicationData<'a, Side>)
Some application data has been received.
CloseNotify
We received a close_notify alert from the peer.
This means the receive path is closed cleanly.
Trait Implementations§
Auto Trait Implementations§
impl<'a, Side> !RefUnwindSafe for ReceiveTrafficState<'a, Side>
impl<'a, Side> !Send for ReceiveTrafficState<'a, Side>
impl<'a, Side> !Sync for ReceiveTrafficState<'a, Side>
impl<'a, Side> !UnwindSafe for ReceiveTrafficState<'a, Side>
impl<'a, Side> Freeze for ReceiveTrafficState<'a, Side>where
<Side as Side>::State: Freeze,
impl<'a, Side> Unpin for ReceiveTrafficState<'a, Side>where
<Side as Side>::State: Unpin,
impl<'a, Side> UnsafeUnpin for ReceiveTrafficState<'a, Side>where
<Side as Side>::State: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more