pub enum KcpError {
CreateFailed,
SendFailed(i32),
RecvWouldBlock,
RecvBufferTooSmall {
need: usize,
got: usize,
},
RecvFailed(i32),
InputFailed(i32),
SetMtuFailed {
mtu: u32,
code: i32,
},
InvalidConfig(String),
ConvMismatch {
expected: u32,
got: u32,
},
OutputError(Error),
}Expand description
Error type for KCP protocol operations.
Each variant maps to a specific failure condition when interacting with
the underlying KCP C library through the safe Kcp wrapper.
Variants§
CreateFailed
Failed to create a KCP instance (e.g., ikcp_create returned null).
SendFailed(i32)
Failed to send data through KCP. The inner value is the C error code.
RecvWouldBlock
No data is available to receive right now. This is not a fatal error;
the caller should retry after feeding more input data and calling update().
RecvBufferTooSmall
The provided receive buffer is too small for the next message.
Fields
RecvFailed(i32)
A generic receive failure with the C error code.
InputFailed(i32)
Failed to feed input data to the KCP engine (e.g., corrupted packet).
SetMtuFailed
Failed to set the MTU to the specified value.
InvalidConfig(String)
An invalid configuration parameter was provided.
ConvMismatch
The conversation ID in the received packet does not match the expected one.
OutputError(Error)
An I/O error occurred in the output callback.
Trait Implementations§
Source§impl Error for KcpError
impl Error for KcpError
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()