examples/discover_devices.rs – struct `DiscoveryFilter` is private
r-bt opened this issue · 2 comments
r-bt commented
I'm attempting to run examples/discover_devices.rs
in my own project. The steps were
cargo new [project-name]
- As per #43 added the dependencies
2.1 cargo add -F full bluer
2.2 cargo add tokio
2.3 cargo add env_logger
2.4 cargo add futures - Copy code from
examples/discover_devices.rs
intosrc/main.rs
cargo run
However then I get:
error[E0603]: struct `DiscoveryFilter` is private
The full error log is blow:
error[E0603]: struct `DiscoveryFilter` is private
--> src/main.rs:3:58
|
3 | use bluer::{Adapter, AdapterEvent, Address, DeviceEvent, DiscoveryFilter, DiscoveryTransport};
| ^^^^^^^^^^^^^^^ private struct
|
note: the struct `DiscoveryFilter` is defined here
--> /home/rbeattie/.cargo/registry/src/index.crates.io-1cd66030c949c28d/bluer-0.15.7/src/lib.rs:536:17
|
536 | pub use crate::{adapter::*, device::*, session::*};
| ^^^^^^^^^^
error[E0603]: enum `DiscoveryTransport` is private
--> src/main.rs:3:75
|
3 | use bluer::{Adapter, AdapterEvent, Address, DeviceEvent, DiscoveryFilter, DiscoveryTransport};
| ^^^^^^^^^^^^^^^^^^ private enum
|
note: the enum `DiscoveryTransport` is defined here
--> /home/rbeattie/.cargo/registry/src/index.crates.io-1cd66030c949c28d/bluer-0.15.7/src/lib.rs:536:17
|
536 | pub use crate::{adapter::*, device::*, session::*};
| ^^^^^^^^^^
error[E0599]: no method named `set_discovery_filter` found for struct `Adapter` in the current scope
--> src/main.rs:58:13
|
58 | adapter.set_discovery_filter(filter).await?;
| ^^^^^^^^^^^^^^^^^^^^ help: there is a method with a similar name: `set_discoverable`
error[E0599]: no method named `discovery_filter` found for struct `Adapter` in the current scope
--> src/main.rs:59:60
|
59 | println!("Using discovery filter:\n{:#?}\n\n", adapter.discovery_filter().await);
| ^^^^^^^^^^^^^^^^ method not found in `Adapter`
Some errors have detailed explanations: E0599, E0603.
For more information about an error, try `rustc --explain E0599`.
error: could not compile `discover` (bin "discover") due to 5 previous errors
I wonder is this related to #90?
surban commented
DiscoveryFilter is public since version 0.16.0-pre1.
r-bt commented
Thanks, upgrading to 0.16.0-pre1 fixed the issue :)