btleplug/
platform.rs

1//! The `platform` module contains the platform-specific implementations of the various [`api`]
2//! traits. Refer for the `api` module for how to use them.
3
4#[cfg(target_os = "linux")]
5pub use crate::bluez::{
6    adapter::Adapter, manager::Manager, peripheral::Peripheral, peripheral::PeripheralId,
7};
8#[cfg(target_vendor = "apple")]
9pub use crate::corebluetooth::{
10    adapter::Adapter, manager::Manager, peripheral::Peripheral, peripheral::PeripheralId,
11};
12#[cfg(target_os = "android")]
13pub use crate::droidplug::{
14    adapter::Adapter, init, manager::Manager, peripheral::Peripheral, peripheral::PeripheralId,
15};
16#[cfg(target_os = "windows")]
17pub use crate::winrtble::{
18    adapter::Adapter, manager::Manager, peripheral::Peripheral, peripheral::PeripheralId,
19};
20
21use crate::api::{self, Central};
22use static_assertions::assert_impl_all;
23use std::{
24    fmt::{Debug, Display},
25    hash::Hash,
26};
27
28// Ensure that the exported types implement all the expected traits.
29assert_impl_all!(Adapter: Central, Clone, Debug, Send, Sized, Sync);
30assert_impl_all!(Manager: api::Manager, Clone, Debug, Send, Sized, Sync);
31assert_impl_all!(Peripheral: api::Peripheral, Clone, Debug, Send, Sized, Sync);
32assert_impl_all!(
33    PeripheralId: Clone,
34    Debug,
35    Display,
36    Hash,
37    Eq,
38    Ord,
39    PartialEq,
40    PartialOrd,
41    Send,
42    Sized,
43    Sync
44);