/// Find a device based on informations about the device
/// Pass None to all fields to get a default device
Find a device based on informations about the device
Pass None to all fields to get a default device
Find a device based on informations about the device Pass None to all fields to get a default device
pub fn find_device(
        &'a self,
        vendor_id: Option<c_int>,
        product_id: Option<c_int>,
        serial_number: Option<&str>,
    ) -> Result<Device<'a>> {
        unsafe {
            let mut device = std::mem::MaybeUninit::<*mut uvc_device>::uninit();
            let cstr = serial_number.map(|v| CString::new(v).unwrap());
            let err = uvc_find_device(
                self.ctx.as_ptr(),
                device.as_mut_ptr(),
                vendor_id.unwrap_or(0),
                product_id.unwrap_or(0),
                cstr.map_or(std::ptr::null(), |v| v.as_ptr()),
            )
            .into();
            if err != Error::Success {
                return Err(err);
            }
            Ok(Device::from_raw(device.assume_init()))
        }
    }
pub fn find_device ( & ' a self , vendor_id : Option < c_int > , product_id : Option < c_int > , serial_number : Option < & str > , ) -> Result < Device < ' a > > { unsafe { let mut device = std :: mem :: MaybeUninit :: < * mut uvc_device > :: uninit ( ) ; let cstr = serial_number . map ( | v | CString :: new ( v ) . unwrap ( ) ) ; let err = uvc_find_device ( self . ctx . as_ptr ( ) , device . as_mut_ptr ( ) , vendor_id . unwrap_or ( 0 ) , product_id . unwrap_or ( 0 ) , cstr . map_or ( std :: ptr :: null ( ) , | v | v . as_ptr ( ) ) , ) . into ( ) ; if err != Error :: Success { return Err ( err ) ; } Ok ( Device :: from_raw ( device . assume_init ( ) ) ) } }
Find a device based on informations about the device
Pass None to all fields to get a default device
Find a device based on informations about the device Pass None to all fields to get a default device
&'a self
vendor_id
Option<c_int>
product_id
Option<c_int>
serial_number
Option<&str>