pub enum ParseProgress<'a> {
Incomplete,
NeedValue {
header: SetHeader<'a>,
value_len: usize,
value_prefix: &'a [u8],
header_consumed: usize,
},
ValueTooLarge {
value_len: usize,
value_prefix_len: usize,
header_consumed: usize,
max_value_size: usize,
},
Complete(Command<'a>, usize),
}Expand description
Result of incremental parsing.
Variants§
Incomplete
Need more data to continue parsing.
NeedValue
Command header parsed, waiting for value data.
The caller should:
- Allocate a buffer for the value (e.g., in cache segment)
- Copy
value_prefixto the start of that buffer - Receive remaining
value_len - value_prefix.len()bytes into the buffer - Call
complete_with_value()to finish parsing
Fields
ValueTooLarge
Value exceeds maximum allowed size - needs to be drained.
The caller should:
- Send an error response to the client
- Drain
value_len + 2bytes (value + trailing CRLF) from the connection - Resume normal parsing
Fields
Complete(Command<'a>, usize)
Fully parsed command (used for non-SET commands or small values).
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for ParseProgress<'a>
impl<'a> RefUnwindSafe for ParseProgress<'a>
impl<'a> Send for ParseProgress<'a>
impl<'a> Sync for ParseProgress<'a>
impl<'a> Unpin for ParseProgress<'a>
impl<'a> UnsafeUnpin for ParseProgress<'a>
impl<'a> UnwindSafe for ParseProgress<'a>
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