pub struct UsbProxy<'a>(/* private fields */);Expand description
This interface provides access to USB devices.
Implementations§
Source§impl<'a> UsbProxy<'a>
impl<'a> UsbProxy<'a>
Sourcepub async fn create_session(&self) -> Result<Session<'a, Self>, Error>
pub async fn create_session(&self) -> Result<Session<'a, Self>, Error>
Create a USB session.
While this session is active, the caller will receive
DeviceEvents signals with device addition and removal.
§Specifications
See also CreateSession.
Sourcepub async fn enumerate_devices(&self) -> Result<Vec<(String, UsbDevice)>, Error>
pub async fn enumerate_devices(&self) -> Result<Vec<(String, UsbDevice)>, Error>
Enumerate USB devices.
Return a vector of tuples with the device ID and the UsbDevice
§Specifications
See also EnumerateDevices.
Sourcepub async fn acquire_devices(
&self,
parent_window: Option<&WindowIdentifier>,
devices: &[Device],
) -> Result<Vec<(String, Result<OwnedFd, UsbError>)>, Error>
pub async fn acquire_devices( &self, parent_window: Option<&WindowIdentifier>, devices: &[Device], ) -> Result<Vec<(String, Result<OwnedFd, UsbError>)>, Error>
Acquire devices
The portal will perform the permission request. In case of success, ie permission is granted, it returns a vector of tuples containing the device ID and the file descriptor or error.
§Specifications
See also AcquireDevices.
Sourcepub async fn release_devices(&self, devices: &[&str]) -> Result<(), Error>
pub async fn release_devices(&self, devices: &[&str]) -> Result<(), Error>
Release devices
Release all the devices whose ID is specified in devices.
§Specifications
See also ReleaseDevices.
Sourcepub async fn receive_device_events(
&self,
) -> Result<impl Stream<Item = UsbDeviceEvent>, Error>
pub async fn receive_device_events( &self, ) -> Result<impl Stream<Item = UsbDeviceEvent>, Error>
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for UsbProxy<'a>
impl<'a> !RefUnwindSafe for UsbProxy<'a>
impl<'a> Send for UsbProxy<'a>
impl<'a> Sync for UsbProxy<'a>
impl<'a> Unpin for UsbProxy<'a>
impl<'a> !UnwindSafe for UsbProxy<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more