taks / esp32-nimble

A wrapper for the ESP32 NimBLE Bluetooth stack.
Apache License 2.0
118 stars 35 forks source link

allow to convert uuid::Uuid value to BleUuid #18

Closed MnlPhlp closed 1 year ago

MnlPhlp commented 1 year ago

Implement the From<uuid::Uuid> trait for BleUuid to allow usage of those uuids by calling into(). In my case i have a common lib used by a client and the esp32. The client library uses the uuid lib for it's ble service/characteristic ids. By implementing this i can now use a common uuid:Uuid value and pass it to nimble functions by calling into()

taks commented 1 year ago

Hello, thanks for your contribution. The cargo clippy -- -D clippy::all command results in the following error.

error: using `clone` on type `[u8; 16]` which implements the `Copy` trait
   --> src/utilities/ble_uuid.rs:159:21
    |
159 |     let mut bytes = uuid.as_bytes().clone();
    |                     ^^^^^^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*uuid.as_bytes()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
    = note: `-D clippy::clone-on-copy` implied by `-D clippy::all`

Could you please fix it?

MnlPhlp commented 1 year ago

the clippy warning is fixed

taks commented 1 year ago

Thanks. The clippy command on the CI fails, but on my machine succeeds, so I merge it.