pub enum Availability {
Unsupported,
PoweredOff,
Unauthorized,
Resetting,
Unknown,
}Expand description
Why Bluetooth is not currently usable.
Variants§
Unsupported
This machine has no Bluetooth LE radio, or its stack does not support it.
PoweredOff
The radio is powered off.
The process has no Bluetooth entitlement — on macOS and iOS this means
no NSBluetoothAlwaysUsageDescription, or the user declined. Note that
the system reports this instead of prompting when the process has no
usage description at all.
Resetting
The adapter is resetting; try again shortly.
Unknown
State is not yet known. CBCentralManager reports this until its first
centralManagerDidUpdateState:, which is why every entry point waits
for that callback before doing anything.
Trait Implementations§
Source§impl Clone for Availability
impl Clone for Availability
impl Copy for Availability
Source§impl Debug for Availability
impl Debug for Availability
Source§impl Display for Availability
impl Display for Availability
impl Eq for Availability
Source§impl Error for Availability
availability() hands an Availability back on its own rather than
wrapped, because an unusable radio is a state rather than a failed call.
That is worth keeping — and it should not also mean a caller cannot put it
where every other failure goes. Without this, reporting one costs a manual
translation into anyhow, Box<dyn Error> or a crate’s own error type at
each call site, which is exactly the boilerplate the trait exists to
prevent.
impl Error for Availability
availability() hands an Availability back on its own rather than
wrapped, because an unusable radio is a state rather than a failed call.
That is worth keeping — and it should not also mean a caller cannot put it
where every other failure goes. Without this, reporting one costs a manual
translation into anyhow, Box<dyn Error> or a crate’s own error type at
each call site, which is exactly the boilerplate the trait exists to
prevent.
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<Availability> for Error
impl From<Availability> for Error
Source§fn from(availability: Availability) -> Self
fn from(availability: Availability) -> Self
The spec resolves a request against an unavailable radio as
NotFoundError, which is what Error::NotAvailable reports — so
? on an availability check inside a function returning Error
produces the same failure the operation itself would have.