You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be good to make McuMgrTransportError conform to equatable, so developers can easily test if certain errors are occurring and act accordingly. We added an extension in our app to do this, but others may have the same need so it would be good if it was apart of the standard framework. See code below.
extension McuMgrTransportError: Equatable {
public static func == (lhs: McuMgrTransportError, rhs: McuMgrTransportError) -> Bool {
switch (lhs, rhs) {
case (.connectionTimeout, .connectionTimeout): return true
case (.connectionFailed, .connectionFailed): return true
case (.disconnected, .disconnected): return true
case (.sendTimeout, .sendTimeout): return true
case (.sendFailed, .sendFailed): return true
case let (.insufficientMtu(lhsMTU), .insufficientMtu(rhsMTU)): return lhsMTU == rhsMTU
case (.badResponse, .badResponse): return true
default: return false
}
}
}
The text was updated successfully, but these errors were encountered:
if this protocol is added in an extension in the same file that the enum is declared (or protocol conformance specified on the type declaration itself) i don't think we can get a synthesised == method since the only associated value used is Int, which is already Equatable
It would be good to make
McuMgrTransportError
conform to equatable, so developers can easily test if certain errors are occurring and act accordingly. We added an extension in our app to do this, but others may have the same need so it would be good if it was apart of the standard framework. See code below.The text was updated successfully, but these errors were encountered: