Medius - Rust LibraryErrors

Errors

The Error enum and the Result alias

Every fallible call returns Result<T>, the crate's alias for core::result::Result<T, Error>.

Error is #[non_exhaustive], so any match needs a wildcard arm.

VariantMeaning
Io(std::io::Error)An underlying serial or OS error.
NotFoundNo device matched the expected VID/PID.
NoReplyThe box never answered the version query during the handshake: wrong port or baud, or not a Medius box.
BadProtoVer { got }The box answered, but its proto_ver wasn't 3; got carries the reported value. See the handshake.
QueryTimeoutA query hit its deadline with no RESP back.
DisconnectedThe device disconnected.
FrameTooLongA payload was over the 512-byte frame limit.
FlashTool(String)The flash tool failed.

FlashTool(String) only exists with the flash feature. On a default build the variant isn't in the enum, so a match arm naming it won't compile. Gate such arms behind #[cfg(feature = "flash")] or lean on the wildcard.