Struct rusb::Device[][src]

pub struct Device<T: UsbContext> { /* fields omitted */ }
Expand description

A reference to a USB device.

Implementations

impl<T: UsbContext> Device<T>[src]

pub fn as_raw(&self) -> *mut libusb_device[src]

Get the raw libusb_device pointer, for advanced use in unsafe code

pub fn context(&self) -> &T[src]

Get the context associated with this device

pub unsafe fn from_libusb(
    context: T,
    device: NonNull<libusb_device>
) -> Device<T>
[src]

Safety

Converts an existing libusb_device pointer into a Device<T>. device must be a pointer to a valid libusb_device. Rusb increments refcount.

pub fn device_descriptor(&self) -> Result<DeviceDescriptor>[src]

Reads the device descriptor.

pub fn config_descriptor(&self, config_index: u8) -> Result<ConfigDescriptor>[src]

Reads a configuration descriptor.

pub fn active_config_descriptor(&self) -> Result<ConfigDescriptor>[src]

Reads the configuration descriptor for the current configuration.

pub fn bus_number(&self) -> u8[src]

Returns the number of the bus that the device is connected to.

pub fn address(&self) -> u8[src]

Returns the device’s address on the bus that it’s connected to.

pub fn speed(&self) -> Speed[src]

Returns the device’s connection speed.

pub fn open(&self) -> Result<DeviceHandle<T>>[src]

Opens the device.

pub fn port_number(&self) -> u8[src]

Returns the device’s port number

pub fn get_parent(&self) -> Option<Self>[src]

Returns the device’s parent

pub fn port_numbers(&self) -> Result<Vec<u8>, Error>[src]

Get the list of all port numbers from root for the specified device

Trait Implementations

impl<T: UsbContext> Debug for Device<T>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<T: UsbContext> Drop for Device<T>[src]

fn drop(&mut self)[src]

Releases the device reference.

impl<T: PartialEq + UsbContext> PartialEq<Device<T>> for Device<T>[src]

fn eq(&self, other: &Device<T>) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Device<T>) -> bool[src]

This method tests for !=.

impl<T: Eq + UsbContext> Eq for Device<T>[src]

impl<T: UsbContext> Send for Device<T>[src]

impl<T: UsbContext> StructuralEq for Device<T>[src]

impl<T: UsbContext> StructuralPartialEq for Device<T>[src]

impl<T: UsbContext> Sync for Device<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for Device<T> where
    T: RefUnwindSafe

impl<T> Unpin for Device<T> where
    T: Unpin

impl<T> UnwindSafe for Device<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.