1- #[ cfg( feature = "rusb" ) ]
1+ #[ cfg( any ( feature = "rusb" , target_os = "windows" ) ) ]
22use rusb:: Error as usbError;
33use std:: error;
44use std:: fmt;
@@ -7,7 +7,7 @@ use std::io::Error as ioError;
77#[ derive( Debug ) ]
88pub enum ChallengeResponseError {
99 IOError ( ioError ) ,
10- #[ cfg( feature = "rusb" ) ]
10+ #[ cfg( any ( feature = "rusb" , target_os = "windows" ) ) ]
1111 UsbError ( usbError ) ,
1212 CommandNotSupported ,
1313 DeviceNotFound ,
@@ -23,7 +23,7 @@ impl fmt::Display for ChallengeResponseError {
2323 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
2424 match * self {
2525 ChallengeResponseError :: IOError ( ref err) => write ! ( f, "IO error: {}" , err) ,
26- #[ cfg( feature = "rusb" ) ]
26+ #[ cfg( any ( feature = "rusb" , target_os = "windows" ) ) ]
2727 ChallengeResponseError :: UsbError ( ref err) => write ! ( f, "USB error: {}" , err) ,
2828 ChallengeResponseError :: DeviceNotFound => write ! ( f, "Device not found" ) ,
2929 ChallengeResponseError :: OpenDeviceError => write ! ( f, "Can not open device" ) ,
@@ -40,7 +40,7 @@ impl fmt::Display for ChallengeResponseError {
4040impl error:: Error for ChallengeResponseError {
4141 fn cause ( & self ) -> Option < & dyn error:: Error > {
4242 match * self {
43- #[ cfg( feature = "rusb" ) ]
43+ #[ cfg( any ( feature = "rusb" , target_os = "windows" ) ) ]
4444 ChallengeResponseError :: UsbError ( ref err) => Some ( err) ,
4545 _ => None ,
4646 }
@@ -53,7 +53,7 @@ impl From<ioError> for ChallengeResponseError {
5353 }
5454}
5555
56- #[ cfg( feature = "rusb" ) ]
56+ #[ cfg( any ( feature = "rusb" , target_os = "windows" ) ) ]
5757impl From < usbError > for ChallengeResponseError {
5858 fn from ( err : usbError ) -> ChallengeResponseError {
5959 ChallengeResponseError :: UsbError ( err)
0 commit comments