servo/third_party/blurmac
Michael Mc Donnell a27f2bb84d
Fix Rust-analyzer errors and warnings in blurmac (#37439)
I got 22 errors and 63 warnings when I opened the Servo project in
Visual Studio Code with the Rust-analyzer extension on Linux. The
`blurmac` package, which is vendored in the source tree, only needs to
be be compiled on macOS.

With this change I get zero errors and 2 unrelated warnings.

Testing: I don't have a mac and cannot test it there. I only tested it
building on Linux. I also did not test test the Bluetooth feature. I
think the change is pretty straightforward and unlikely to cause a major
regression.

Signed-off-by: Michael Mc Donnell <michael@mcdonnell.dk>
2025-06-14 06:08:07 +00:00
..
src Fix Rust-analyzer errors and warnings in blurmac (#37439) 2025-06-14 06:08:07 +00:00
Cargo.lock Integrate the devices respository (#30974) 2024-01-09 09:13:41 +00:00
Cargo.toml Set a Rust edition for blurmac (#34618) 2024-12-14 11:18:00 +00:00
LICENSE.md Integrate the devices respository (#30974) 2024-01-09 09:13:41 +00:00
README.md Integrate the devices respository (#30974) 2024-01-09 09:13:41 +00:00

Bluetooth Rust lib using macOS CoreBluetooth

Build Status Crates.io

The main aim of BlurMac is to enable WebBluetooth in Servo on macOS. Thus, API and implementation decisions are affected by the encapsulating Devices, and the sibling BlurZ and BlurDroid crates.

Run Servo with WebBluetooth Enabled

Usually, you don't want to work with BlurMac on its own but use it within Servo. So, most probably you'll want to run Servo with WebBluetooth enabled:

RUST_LOG=blurmac \
./mach run \
    --dev \
    --pref=dom.bluetooth.enabled \
    --pref=dom.permissions.testing.allowed_in_nonsecure_contexts \
    URL

Notes:

  • The above command is actually not really BlurMac-specific (except for the RUST_LOG part). It runs Servo with WBT enabled on any platform where WBT is supported.
  • You don't need the RUST_LOG=blurmac part if you don't want to see BlurMac debug messages on the console.
  • You don't need the --dev part if you want to run a release build.
  • You don't need the --pref=dom.permissions.testing.allowed_in_nonsecure_contexts part if your URL is https (but you do need it if you test a local file).

Known Issues

  • Device RSSI can not be retrieved yet.
  • Support for included services is incomplete.
  • Descriptors are not supported yet.
  • Notifications on characteristics are not supported yet (the limitation comes from Devices).

Compatibility

Tested on:

  • macOS Sierra 10.12.

Licensed under the BSD 3-Clause License.