enum NixFramedReaderState {
ReadingSize {
buf: [u8; 8],
filled: usize,
},
ReadingPayload {
remaining: u64,
},
}
Expand description
State machine for NixFramedReader
.
As the reader progresses it linearly cycles through the states.
Variants§
ReadingSize
The reader always starts in this state.
Before the payload, the client first sends its size.
The size is a u64 which is 8 bytes long, while it’s likely that we will receive
the whole u64 in one read, it’s possible that it will arrive in smaller chunks.
So in this state we read up to 8 bytes and transition to
NixFramedReaderState::ReadingPayload
when done if the read size is not zero,
otherwise we reset filled to 0, and read the next size value.
ReadingPayload
This is where we read the actual payload that is sent to us.
Once we’ve read the expected number of bytes, we go back to the
NixFramedReaderState::ReadingSize
state.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NixFramedReaderState
impl RefUnwindSafe for NixFramedReaderState
impl Send for NixFramedReaderState
impl Sync for NixFramedReaderState
impl Unpin for NixFramedReaderState
impl UnwindSafe for NixFramedReaderState
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