Closed
Description
Error
trait is crucial in usage like converting error to something like Anyhow::Error
,which can be used to propagate errors simply. Some functions use Error<()>
, but unit type is not Display
, so it will not have Error
trait.
A workaround looks like this, which requires manual conversion of error.
let serial = bs.open_protocol_exclusive::<Serial>(serial_handle).map_err(|x| anyhow!("Failed to open serial protocol, status {}",x.status()))?;
Due to implementation of a trait cannot overlap, simply do impl<Data: Debug> Display for Error<Data>
will not work.
Metadata
Metadata
Assignees
Labels
No labels