pub enum Error {
Io(Error),
Json(Error),
Connection(String),
Protocol(String),
Config(String),
Test(String),
}Expand description
Error types for rperf3 operations.
This enum covers all error cases that can occur during network performance testing, from I/O errors to protocol violations.
§Examples
use rperf3::Error;
fn check_config(server_addr: Option<String>) -> Result<(), Error> {
match server_addr {
Some(_) => Ok(()),
None => Err(Error::Config("Server address required".to_string())),
}
}Variants§
Io(Error)
I/O error occurred during network operations.
This wraps standard std::io::Error and is used for all I/O-related failures
such as socket errors, connection failures, and read/write errors.
Json(Error)
JSON serialization or deserialization error.
Occurs when encoding or decoding JSON data for protocol messages or output.
Connection(String)
Connection-related error.
Used for errors specific to establishing or maintaining network connections, such as connection refused, timeout, or unexpected disconnection.
Protocol(String)
Protocol violation or parsing error.
Occurs when the client and server exchange malformed or unexpected messages.
Config(String)
Configuration error.
Used when the provided configuration is invalid or incomplete.
Test(String)
Test execution error.
Covers errors that occur during test execution that don’t fit other categories.