pub enum RequestFrameError {
RequestTooLarge {
len: usize,
},
BufferTooSmall {
needed: usize,
available: usize,
},
}Expand description
A request could not be framed. Nothing was written to the header, so a caller that sends only what a successful call reported sends nothing that could desync the node’s framing.
Variants§
RequestTooLarge
The body, with the tag and the ID in front of it, would not fit in
one frame of MAX_FRAME_SIZE bytes. len is that payload length
(tag, ID and body), saturated at usize::MAX for an absurd body
length.
BufferTooSmall
The buffer cannot hold the frame: needed bytes, header included,
against the available length of the buffer. Either the buffer is
shorter than REQUEST_HEADER_LEN, or the body runs past its end
(from an encoder, a bug: it reported more than it was handed).
Trait Implementations§
Source§impl Clone for RequestFrameError
impl Clone for RequestFrameError
impl Copy for RequestFrameError
Source§impl Debug for RequestFrameError
impl Debug for RequestFrameError
Source§impl Display for RequestFrameError
impl Display for RequestFrameError
impl Eq for RequestFrameError
Source§impl Error for RequestFrameError
impl Error for RequestFrameError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<RequestFrameError> for ProtocolError
impl From<RequestFrameError> for ProtocolError
Source§fn from(e: RequestFrameError) -> Self
fn from(e: RequestFrameError) -> Self
For a codec whose error is ProtocolError, so its request
encoder frames with ?. An oversized request is
MessageTooLarge with the
payload length; a buffer too small is
Truncated, what this crate’s own
encoders report for a buffer that cannot hold their output.