use alloc::string::String;
#[derive(Clone, Debug, PartialEq, Eq, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
#[error("timed out waiting for the device")]
Timeout,
#[error("the connection to the device was closed")]
Disconnected,
#[error("transport error: {0}")]
Transport(String),
#[error("protocol violation: {0}")]
Protocol(String),
#[error("device rejected command {command:#04x} with code {code:#04x}")]
Rejected {
command: u8,
code: u8,
},
#[error("unsupported: {0}")]
Unsupported(&'static str),
}
pub type Result<T, E = Error> = core::result::Result<T, E>;