Trait Manager

Source
pub trait Manager {
    type Adapter: Central;

    // Required method
    fn adapters<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Self::Adapter>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

The Manager is the entry point to the library, providing access to all the Bluetooth adapters on the system. You can obtain an instance from platform::Manager::new().

§Usage

use btleplug::api::Manager as _;
use btleplug::platform::Manager;

let manager = Manager::new().await?;
let adapter_list = manager.adapters().await?;
if adapter_list.is_empty() {
   eprintln!("No Bluetooth adapters");
}

Required Associated Types§

Source

type Adapter: Central

The concrete type of the Central implementation.

Required Methods§

Source

fn adapters<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Self::Adapter>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get a list of all Bluetooth adapters on the system. Each adapter implements Central.

Implementors§