pub struct DeviceWatchBuilder { /* private fields */ }Expand description
Configure a DeviceWatch before starting it.
Only needed to widen device matching or to tune the settle delay; most callers want
watch_devices.
Implementations§
Source§impl DeviceWatchBuilder
impl DeviceWatchBuilder
Sourcepub fn known_devices(self, known: &[(u16, u16)]) -> Self
pub fn known_devices(self, known: &[(u16, u16)]) -> Self
Also report devices matching these VID/PID pairs, even when their USB descriptors don’t carry the standard MTP class codes.
Mirrors
MtpDevice::list_devices_with_known; pass
the same list to both so a device you can list is also a device you can watch for.
Sourcepub fn settle_delay(self, delay: Duration) -> Self
pub fn settle_delay(self, delay: Duration) -> Self
How long to wait after a USB event before enumerating (default
DEFAULT_SETTLE_DELAY).
Lower it to react faster at the risk of missing a device that hasn’t finished describing
itself; raise it for devices that are slow to enumerate. Duration::ZERO enumerates
immediately.
Sourcepub fn watch(self) -> Result<DeviceWatch, Error>
pub fn watch(self) -> Result<DeviceWatch, Error>
Start watching.
Enumerates once up front, so every device already connected is reported as
HotplugEvent::Arrived when the stream is first polled.
§Errors
Returns an error if the OS refuses to set up USB hotplug notifications.
Trait Implementations§
Source§impl Clone for DeviceWatchBuilder
impl Clone for DeviceWatchBuilder
Source§fn clone(&self) -> DeviceWatchBuilder
fn clone(&self) -> DeviceWatchBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more