Files
nearby/fastpair/rust
Lucas Silva Shepard e73a9bb9a8 [fp-rs] Updated API for accessing platform-specific structs.
Previously, `Device` trait was implemented by both Classic and BLE
Devices. This forced usage of associated types for choosing the type of
address employed, bringing about limitations of Rust's type system. By
ensuring cross-platform traits are only used for shared cross-platform
behavior, there are no longer type annotation issues in the application
layer.

Changes:
* Split the `Device` trait into `ClassicDevice` and `BleDevice`.
* Migrated these to an `api/` module to avoid name clashes and clearly
  differentiate common structs (under `common/) from common traits (under
  `api/)`.
* Removed shared `Address` enum in order to get rid of device's address
  associated type.
* Application layer can now only talk to impl traits rather than the concrete
  platform-specific type. This ensures compile-time behavior guarantees.
  Constructors for cross-platform impls provided under the `Platform`
  unit struct.
* Updated `unsupported` module for unsupported platforms. Previously,
  dummy inherent impls would've been necessary for calling the `new()`
  method. This is now part of the `ClassicDevice` and `BleDevice` API,
  so cross-platform behavior is guaranteed to work.
2023-07-29 17:23:45 -07:00
..