usbip icon indicating copy to clipboard operation
usbip copied to clipboard

Derive Debug for all structs

Open h7x4 opened this issue 1 year ago • 5 comments

Let all structs derive debug for ease of debugging.

The only thing that I feel is a little questionable about this is making UsbInterfaceHandler and UsbDeviceHandler into a supertraits of Debug. Although not semantically correct, it is meant to force UsbDevice.device_handler: Option<Arc<Mutex<Box<dyn UsbDeviceHandler + Send>>>> to be debuggable, so UsbDevice can be so as well. Would it be better to maintain a manual implementation here?

h7x4 avatar Jun 19 '23 13:06 h7x4

I don't know what's the best practice, but it might break existing code not impl-ing Debug?

jiegec avatar Jun 19 '23 14:06 jiegec

... it might break existing code not impl-ing Debug?

That's a good call. Do you think it would be better to create a manual implementation? I guess something like derivative also is an option, at the cost of introducing a new dependency.

h7x4 avatar Jun 19 '23 14:06 h7x4

Could this be a package configuration option instead?

jamesadevine avatar Jun 20 '23 14:06 jamesadevine

That works for me. I've never heard of debug being a used as a configuration option though. Is the intention to include the extra dependency only for those that need it?

h7x4 avatar Jun 20 '23 14:06 h7x4

I don't think it is a big deal to derive the debug struct personally.

jamesadevine avatar Jun 20 '23 14:06 jamesadevine

Pull Request Test Coverage Report for Build 5312749491

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 3 of 11 (27.27%) changed or added relevant lines in 6 files are covered.
  • 6 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.3%) to 41.353%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/cdc.rs 0 1 0.0%
src/interface.rs 0 1 0.0%
src/lib.rs 0 1 0.0%
src/host.rs 0 2 0.0%
src/hid.rs 0 3 0.0%
<!-- Total: 3 11
Files with Coverage Reduction New Missed Lines %
src/hid.rs 2 25.0%
src/host.rs 2 0.0%
src/lib.rs 2 52.71%
<!-- Total: 6
Totals Coverage Status
Change from base Build 4244317147: -0.3%
Covered Lines: 550
Relevant Lines: 1330

💛 - Coveralls

coveralls avatar Jul 14 '24 04:07 coveralls

Pull Request Test Coverage Report for Build 5312749491

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 3 of 11 (27.27%) changed or added relevant lines in 6 files are covered.
  • 6 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.3%) to 41.353%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/cdc.rs 0 1 0.0%
src/interface.rs 0 1 0.0%
src/lib.rs 0 1 0.0%
src/host.rs 0 2 0.0%
src/hid.rs 0 3 0.0%
<!-- Total: 3 11
Files with Coverage Reduction New Missed Lines %
src/hid.rs 2 25.0%
src/host.rs 2 0.0%
src/lib.rs 2 52.71%
<!-- Total: 6
Totals Coverage Status
Change from base Build 4244317147: -0.3%
Covered Lines: 550
Relevant Lines: 1330

💛 - Coveralls

coveralls avatar Jul 14 '24 04:07 coveralls