cholcombe973 / block-utils

Rust utilities for working with block devices
MIT License
22 stars 17 forks source link

Avoid the boilerplate in enums with strum #28

Closed Apostoln closed 3 years ago

Apostoln commented 3 years ago

The goal of this PR is refactoring to avoid boilerplate in enums implementation.

First commit: Use strum crate for enums

Changes:

Changes in public interface:

Note:

Second commit: Use thiserror crate for errors Changes:

This commit is not in the scope of initial issue, so I will revert it if you want.

Checks:

  1. Current tests are Ok (but seems they don't use the changed functionality)
  2. I've manually checked the accuracy of changes in terms of the same strings before and after these changes.
  3. I use the fork with these changes in our project, and its tests are passed If you think that this PR can't be merged without adding new tests let me know.

Also it would be great to release a new version of block-utils after merging this PR due to changes in #25

Close #26