Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Make API more idiomatic and don't query devices if not needed This introduces a rust-y API with two main objects: - `Device` represents a device that has not been opened yet - `DeviceHandle` is a device that has been opened and which has methods to get/set its state. Also, all serde-related stuff has been moved to `main.rs` since it's not needed for the library itself. This opens the possibility to reduce the dependencies of the library even more in the future. * Use more descriptive `device_type_from_product_id` function name * Increase clippy warning level and fix warnings * Enforce and add documentation of all public library members * Move serial number filtering to `main.rs` * build: Mark binary-only dependencies as optional * Expose device info of `Device` * Rework device serial number filtering code * Add `Litra` object to encapsulate the hidapi context * Use more efficient `find()` instead of `filter().next()` * build: Mark `cli` as default feature for easy binary building For library usage, you can skip the unneeded dependencies by specifing `litra` as dependency in your `Cargo.toml` like this: [dependencies] litra = { version = "<version>", default-features = false } * refactor: Rename "enabled" to "on" * Move range checks into `lib.rs` and improve library error handling * Streamline error handling in `main.rs` * build: Bump versions in `Cargo.lock` * Remove unnecessary import in `lib.rs` * ci: Remove `Cargo.lock` from pre-commit GitHub Actions workflow This should not be done in checks for PRs. Instead, this is better being taken care of by dependabot or something similar. * Add error handling for brightness calculation errors to `main.rs`
- Loading branch information