Maintainers
Pricing
Enterprise
More
More
Documentation
Try Live
Rankings
Install
Blog
Docs7
Ask
New
Add Docs
libftd3xx
https://docs.rs/libftd3xx
Admin
libftd3xx is a Rust library providing bindings for the FTDI D3XX drivers.
Tokens:
78,054
Snippets:
550
Trust Score:
9.1
Update:
3 months ago
Context
Chat
Benchmark
70
Latest
Show doc for...
Code
Info
Show Results
Tokens:
Raw
Copy
Link
Tokens:
Raw
Copy
Link
### FT_GetChipConfiguration Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/index.html Gets the chip configuration of the device. ```APIDOC ## FT_GetChipConfiguration ### Description Retrieves the chip configuration settings from the FTDI device. ### Function Signature `pub fn FT_GetChipConfiguration(ftHandle: FT_HANDLE, pConfig: *mut FT_60XCONFIGURATION) -> FT_STATUS;` ### Parameters - `ftHandle` (FT_HANDLE) - Handle to the FTDI device. - `pConfig` (*mut FT_60XCONFIGURATION) - Pointer to a `FT_60XCONFIGURATION` structure to store the configuration. ### Returns - `FT_STATUS` - Status code indicating success or failure. ``` -------------------------------- ### Option::ok_or_else Example Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/type.FT_NOTIFICATION_CALLBACK.html Demonstrates converting an Option to a Result using `ok_or_else`, providing an error value if the Option is None. ```rust let x: Option<&str> = None; assert_eq!(x.ok_or_else(|| 0), Err(0)); ``` -------------------------------- ### Option::iter Example Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/type.FT_NOTIFICATION_CALLBACK.html Demonstrates iterating over the value within an Option using `iter`, which yields at most one element. ```rust let x = Some(4); assert_eq!(x.iter().next(), Some(&4)); let x: Option<u32> = None; assert_eq!(x.iter().next(), None); ``` -------------------------------- ### Option::into_flat_iter Example Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/type.FT_NOTIFICATION_CALLBACK.html Demonstrates transforming an optional iterator into a flattened iterator. This is a nightly-only experimental API. ```rust #![feature(option_into_flat_iter)] let o1 = Some([1, 2]); let o2 = None::<&[usize]>; assert_eq!(o1.into_flat_iter().collect::<Vec<_>>(), [1, 2]); assert_eq!(o2.into_flat_iter().collect::<Vec<_>>(), Vec::<&usize>::new()); ``` -------------------------------- ### Option::or Example Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/type.FT_NOTIFICATION_CALLBACK.html Demonstrates the `or` method, which returns the first Option if it's Some, otherwise returns the second Option. Arguments are eagerly evaluated. ```rust let x = Some(2); let y = None; assert_eq!(x.or(y), Some(2)); let x = None; let y = Some(100); assert_eq!(x.or(y), Some(100)); let x = Some(2); let y = Some(100); assert_eq!(x.or(y), Some(2)); let x: Option<u32> = None; let y = None; assert_eq!(x.or(y), None); ``` -------------------------------- ### Option::and Example Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/type.FT_NOTIFICATION_CALLBACK.html Illustrates the `and` method, which returns the second Option if the first is Some, otherwise returns None. Arguments are eagerly evaluated. ```rust let x = Some(2); let y: Option<&str> = None; assert_eq!(x.and(y), None); let x: Option<u32> = None; let y = Some("foo"); assert_eq!(x.and(y), None); let x = Some(2); let y = Some("foo"); assert_eq!(x.and(y), Some("foo")); let x: Option<u32> = None; let y: Option<&str> = None; assert_eq!(x.and(y), None); ``` -------------------------------- ### Option::as_pin_ref Example Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/type.FT_NOTIFICATION_CALLBACK.html Converts a Pin<&Option<T>> to an Option<Pin<&T>>. This is relevant for types that have pinning requirements. ```rust pub const fn as_pin_ref(self: Pin<&Option<T>>) -> Option<Pin<&T>> ``` -------------------------------- ### Option<T> Try Trait Example Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/type.FT_NOTIFICATION_CALLBACK.html Demonstrates the usage of the Try trait with Option<T>. This is a nightly-only experimental API. ```rust let words = vec!["have", "a", "good", "day"]; let total: Option<usize> = words.iter().map(|w| w.find('a')).sum(); assert_eq!(total, None); ``` -------------------------------- ### Option::iter_mut Example Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/type.FT_NOTIFICATION_CALLBACK.html Shows how to get a mutable iterator over the value in an Option using `iter_mut`, allowing modification. ```rust let mut x = Some(4); match x.iter_mut().next() { Some(v) => *v = 42, None => {}, } assert_eq!(x, Some(42)); let mut x: Option<u32> = None; assert_eq!(x.iter_mut().next(), None); ``` -------------------------------- ### FT_GetFirmwareVersion Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/index.html Gets the firmware version of the FTDI device. ```APIDOC ## FT_GetFirmwareVersion ### Description Retrieves the firmware version of the FTDI device. ### Function Signature `pub fn FT_GetFirmwareVersion(ftHandle: FT_HANDLE, lpdwVersion: LPDWORD) -> FT_STATUS;` ### Parameters - `ftHandle` (FT_HANDLE) - Handle to the FTDI device. - `lpdwVersion` (LPDWORD) - Pointer to a DWORD that will receive the firmware version. ### Returns - `FT_STATUS` - Status code indicating success or failure. ``` -------------------------------- ### Define _FT_SETUP_PACKET Struct Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/struct._FT_SETUP_PACKET.html This struct defines the layout for a USB setup packet, used for control transfers. It is marked with `#[repr(C)]` to ensure C-compatible memory layout. ```rust #[repr(C)] pub struct _FT_SETUP_PACKET { pub RequestType: UCHAR, pub Request: UCHAR, pub Value: USHORT, pub Index: USHORT, pub Length: USHORT, } ``` -------------------------------- ### Option::is_none_or Example Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/type.FT_NOTIFICATION_CALLBACK.html Checks if an Option is None or its value satisfies a predicate. ```rust let x: Option<u32> = Some(2); assert_eq!(x.is_none_or(|x| x > 1), true); let x: Option<u32> = Some(0); assert_eq!(x.is_none_or(|x| x > 1), false); let x: Option<u32> = None; assert_eq!(x.is_none_or(|x| x > 1), true); let x: Option<String> = Some("ownership".to_string()); assert_eq!(x.as_ref().is_none_or(|x| x.len() > 1), true); println!("still alive {:?}", x); ``` -------------------------------- ### Option::as_deref Example Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/type.FT_NOTIFICATION_CALLBACK.html Shows how `as_deref` converts an Option<T> to an Option<&T::Target> by dereferencing the inner value. ```rust let x: Option<String> = Some("hey".to_owned()); assert_eq!(x.as_deref(), Some("hey")); let x: Option<String> = None; assert_eq!(x.as_deref(), None); ``` -------------------------------- ### Option::and_then Example (Chaining Fallible Operations) Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/type.FT_NOTIFICATION_CALLBACK.html Demonstrates `and_then` for chaining operations that return Option. It lazily evaluates the closure, useful for fallible operations. ```rust fn sq_then_to_string(x: u32) -> Option<String> { x.checked_mul(x).map(|sq| sq.to_string()) } assert_eq!(Some(2).and_then(sq_then_to_string), Some(4.to_string())); assert_eq!(Some(1_000_000).and_then(sq_then_to_string), None); // overflowed! assert_eq!(None.and_then(sq_then_to_string), None); ``` ```rust let arr_2d = [["A0", "A1"], ["B0", "B1"]]; let item_0_1 = arr_2d.get(0).and_then(|row| row.get(1)); assert_eq!(item_0_1, Some(&"A1")); let item_2_0 = arr_2d.get(2).and_then(|row| row.get(0)); assert_eq!(item_2_0, None); ``` -------------------------------- ### FT_GetDescriptor Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/index.html Gets a descriptor from the device. ```APIDOC ## FT_GetDescriptor ### Description Retrieves a specific descriptor from the FTDI device. ### Function Signature `pub fn FT_GetDescriptor(ftHandle: FT_HANDLE, ucDescriptorType: UCHAR, ucIndex: UCHAR, pBuffer: LPVOID, ulLength: ULONG, pulBytesReturned: LPDWORD) -> FT_STATUS;` ### Parameters - `ftHandle` (FT_HANDLE) - Handle to the FTDI device. - `ucDescriptorType` (UCHAR) - The type of descriptor to retrieve (e.g., `FT_DEVICE_DESCRIPTOR_TYPE`, `FT_STRING_DESCRIPTOR_TYPE`). - `ucIndex` (UCHAR) - The index of the descriptor. - `pBuffer` (LPVOID) - Pointer to a buffer to store the descriptor data. - `ulLength` (ULONG) - The size of the buffer. - `pulBytesReturned` (LPDWORD) - Pointer to a DWORD that receives the number of bytes returned. ### Returns - `FT_STATUS` - Status code indicating success or failure. ``` -------------------------------- ### Option::is_some_and Example Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/type.FT_NOTIFICATION_CALLBACK.html Checks if an Option is Some and its value satisfies a predicate. ```rust let x: Option<u32> = Some(2); assert_eq!(x.is_some_and(|x| x > 1), true); let x: Option<u32> = Some(0); assert_eq!(x.is_some_and(|x| x > 1), false); let x: Option<u32> = None; assert_eq!(x.is_some_and(|x| x > 1), false); let x: Option<String> = Some("ownership".to_string()); assert_eq!(x.as_ref().is_some_and(|x| x.len() > 1), true); println!("still alive {:?}", x); ``` -------------------------------- ### FT_OPEN_BY_GUID Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/constant.FT_OPEN_BY_GUID.html The FT_OPEN_BY_GUID constant is a flag used to specify that a device should be opened using its GUID. It is part of the libftd3xx_ffi crate. ```APIDOC ## Constant FT_OPEN_BY_GUID ### Summary ``` pub const FT_OPEN_BY_GUID: u32 = 8; ``` ### Description The `FT_OPEN_BY_GUID` constant is a numerical value (8) used as a flag in the `libftd3xx_ffi` library. It indicates that the `FT_OpenEx` function should attempt to open a device identified by its Globally Unique Identifier (GUID). ``` -------------------------------- ### Option::as_pin_mut Example Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/type.FT_NOTIFICATION_CALLBACK.html Converts a mutable Pin<&mut Option<T>> to an Option<Pin<&mut T>>. This is relevant for types that have pinning requirements. ```rust pub const fn as_pin_mut(self: Pin<&mut Option<T>>) -> Option<Pin<&mut T>> ``` -------------------------------- ### Option<T> IntoIterator Example Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/type.FT_NOTIFICATION_CALLBACK.html Demonstrates converting an Option<T> into an iterator. Collects the value if Some, or results in an empty vector if None. ```rust let x = Some("string"); let v: Vec<&str> = x.into_iter().collect(); assert_eq!(v, ["string"]); let x = None; let v: Vec<&str> = x.into_iter().collect(); assert!(v.is_empty()); ``` -------------------------------- ### Option::is_some Example Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/type.FT_NOTIFICATION_CALLBACK.html Checks if an Option contains a Some value. ```rust let x: Option<u32> = Some(2); assert_eq!(x.is_some(), true); let x: Option<u32> = None; assert_eq!(x.is_some(), false); ``` -------------------------------- ### FT_OPEN_BY_GUID Constant Definition Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/constant.FT_OPEN_BY_GUID.html Defines the FT_OPEN_BY_GUID constant, which is a u32 value representing the flag for opening a device by its GUID. ```rust pub const FT_OPEN_BY_GUID: u32 = 8; ``` -------------------------------- ### Option::or_else Example Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/type.FT_NOTIFICATION_CALLBACK.html Illustrates `or_else` for providing a fallback Option lazily. The closure is only called if the first Option is None. ```rust fn nobody() -> Option<&'static str> { None } fn vikings() -> Option<&'static str> { Some("vikings") } ``` -------------------------------- ### Option<T> Product Example Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/type.FT_NOTIFICATION_CALLBACK.html Illustrates using the Product trait with Option<T> to multiply values from an iterator. The operation returns None if any element fails to parse. ```rust let nums = vec!["5", "10", "1", "2"]; let total: Option<usize> = nums.iter().map(|w| w.parse::<usize>().ok()).product(); assert_eq!(total, Some(100)); let nums = vec!["5", "10", "one", "2"]; let total: Option<usize> = nums.iter().map(|w| w.parse::<usize>().ok()).product(); assert_eq!(total, None); ``` -------------------------------- ### Option::as_ref Example Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/type.FT_NOTIFICATION_CALLBACK.html Converts an Option<T> to an Option<&T>, allowing access to the inner value without consuming the Option. Useful for inspecting values without taking ownership. ```rust let text: Option<String> = Some("Hello, world!".to_string()); // First, cast `Option<String>` to `Option<&String>` with `as_ref`, // then consume *that* with `map`, leaving `text` on the stack. let text_length: Option<usize> = text.as_ref().map(|s| s.len()); println!("still can print text: {:?}", text); ``` -------------------------------- ### Option::as_mut Example Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/type.FT_NOTIFICATION_CALLBACK.html Converts a mutable Option<T> to an Option<&mut T>, allowing mutable access to the inner value. ```rust let mut x = Some(2); match x.as_mut() { Some(v) => *v = 42, None => {}, } assert_eq!(x, Some(42)); ``` -------------------------------- ### Option::filter Example Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/type.FT_NOTIFICATION_CALLBACK.html Shows how `filter` conditionally keeps a value in an Option based on a predicate. If the predicate is false or the Option is None, it returns None. ```rust fn is_even(n: &i32) -> bool { n % 2 == 0 } assert_eq!(None.filter(is_even), None); assert_eq!(Some(3).filter(is_even), None); assert_eq!(Some(4).filter(is_even), Some(4)); ``` -------------------------------- ### Option::as_deref_mut Example Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/type.FT_NOTIFICATION_CALLBACK.html Illustrates using `as_deref_mut` to obtain a mutable reference to the dereferenced inner value of an Option. ```rust let mut x: Option<String> = Some("hey".to_owned()); assert_eq!(x.as_deref_mut().map(|x| { x.make_ascii_uppercase(); x }), Some("HEY".to_owned().as_mut_str())); ``` -------------------------------- ### Re-export FT_OPEN constants Source: https://docs.rs/libftd3xx-ffi/0.0.2/src/libftd3xx_ffi/prelude.rs.html Re-exports constants for opening devices by various criteria like serial number, description, location, GUID, or index. Choose the appropriate constant for device identification. ```rust pub use crate::{ FT_OPEN_BY_SERIAL_NUMBER, FT_OPEN_BY_DESCRIPTION, FT_OPEN_BY_LOCATION, FT_OPEN_BY_GUID, FT_OPEN_BY_INDEX }; ``` -------------------------------- ### Device Opening Options Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/prelude/index.html Re-exports constants for specifying how to open a device. ```APIDOC ## Device Opening Options ### Description Constants used to specify the method for opening an FTDI device. ### Constants - `FT_OPEN_BY_SERIAL_NUMBER`: Open by serial number. - `FT_OPEN_BY_DESCRIPTION`: Open by description. - `FT_OPEN_BY_LOCATION`: Open by location ID. - `FT_OPEN_BY_GUID`: Open by GUID. ``` -------------------------------- ### Default _FT_SETUP_PACKET Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/struct._FT_SETUP_PACKET.html Provides a default value for _FT_SETUP_PACKET, initializing all fields to their default states. This is useful for creating new packet structures. ```rust fn default() -> _FT_SETUP_PACKET ``` -------------------------------- ### _FT_SETUP_PACKET Struct Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/struct._FT_SETUP_PACKET.html The _FT_SETUP_PACKET struct is used for setting up USB packets. It contains fields for request type, request, value, index, and length. ```APIDOC ## Struct _FT_SETUP_PACKET ### Summary ```rust #[repr(C)] pub struct _FT_SETUP_PACKET { pub RequestType: UCHAR, pub Request: UCHAR, pub Value: USHORT, pub Index: USHORT, pub Length: USHORT, } ``` ## Fields * `RequestType`: UCHAR * `Request`: UCHAR * `Value`: USHORT * `Index`: USHORT * `Length`: USHORT ## Trait Implementations ### `impl Clone for _FT_SETUP_PACKET` * `fn clone(&self) -> _FT_SETUP_PACKET`: Returns a duplicate of the value. * `fn clone_from(&mut self, source: &Self)`: Performs copy-assignment from `source`. ### `impl Debug for _FT_SETUP_PACKET` * `fn fmt(&self, f: &mut Formatter<'_>) -> Result`: Formats the value using the given formatter. ### `impl Default for _FT_SETUP_PACKET` * `fn default() -> _FT_SETUP_PACKET`: Returns the “default value” for a type. ### `impl Copy for _FT_SETUP_PACKET` ``` -------------------------------- ### Option::is_none Example Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/type.FT_NOTIFICATION_CALLBACK.html Checks if an Option contains a None value. ```rust let x: Option<u32> = Some(2); assert_eq!(x.is_none(), false); let x: Option<u32> = None; assert_eq!(x.is_none(), true); ``` -------------------------------- ### Device Listing Options Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/prelude/index.html Re-exports constants for specifying how to list devices. ```APIDOC ## Device Listing Options ### Description Constants used with `FT_ListDevices` to specify the desired device listing behavior. ### Constants - `FT_LIST_ALL`: List all devices. - `FT_LIST_BY_INDEX`: List devices by index. - `FT_LIST_NUMBER_ONLY`: List only the number of devices. ``` -------------------------------- ### FT_GetLibraryVersion Function Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/prelude/index.html Re-exports the FT_GetLibraryVersion function, used to get the library version. ```APIDOC ## FT_GetLibraryVersion ### Description Retrieves the version of the libftd3xx library. ### Signature `pub fn FT_GetLibraryVersion(version: *mut u32) -> FT_STATUS` ``` -------------------------------- ### Clone _FT_SETUP_PACKET Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/struct._FT_SETUP_PACKET.html Provides functionality to create a duplicate of an existing _FT_SETUP_PACKET instance. This is useful for making copies of packet configurations. ```rust fn clone(&self) -> _FT_SETUP_PACKET ``` -------------------------------- ### FT_GetDriverVersion Function Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/prelude/index.html Re-exports the FT_GetDriverVersion function, used to get the driver version. ```APIDOC ## FT_GetDriverVersion ### Description Retrieves the version of the installed FTDI driver. ### Signature `pub fn FT_GetDriverVersion(version: *mut u32) -> FT_STATUS` ``` -------------------------------- ### FT_GetChipConfiguration Function Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/prelude/index.html Re-exports the FT_GetChipConfiguration function, used to get the chip configuration. ```APIDOC ## FT_GetChipConfiguration ### Description Retrieves the current configuration settings of the FTDI chip. ### Signature `pub fn FT_GetChipConfiguration(handle: FT_HANDLE, config: *mut u8) -> FT_STATUS` ``` -------------------------------- ### Test Layout for _FT_SETUP_PACKET Source: https://docs.rs/libftd3xx-ffi/0.0.2/src/libftd3xx_ffi/bindings_linux_x64.rs.html Verifies the memory size and alignment of the _FT_SETUP_PACKET structure. This test ensures that the generated bindings correctly represent the C structure's layout. ```rust #[test] fn bindgen_test_layout__FT_SETUP_PACKET() { const UNINIT: ::std::mem::MaybeUninit<_FT_SETUP_PACKET> = ::std::mem::MaybeUninit::uninit(); let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<_FT_SETUP_PACKET>(), 16usize, concat!("Size of: ", stringify!(_FT_SETUP_PACKET)) ); assert_eq!( ::std::mem::align_of::<_FT_SETUP_PACKET>(), 8usize, concat!("Alignment of ", stringify!(_FT_SETUP_PACKET)) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).bmRequestType) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", stringify!(_FT_SETUP_PACKET), "::", stringify!(bmRequestType) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).bRequest) as usize - ptr as usize }, 1usize, concat!( "Offset of field: ", stringify!(_FT_SETUP_PACKET), "::", stringify!(bRequest) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).wValue) as usize - ptr as usize }, 2usize, concat!( "Offset of field: ", stringify!(_FT_SETUP_PACKET), "::", stringify!(wValue) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).wIndex) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", stringify!(_FT_SETUP_PACKET), "::", stringify!(wIndex) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).wLength) as usize - ptr as usize }, 6usize, concat!( "Offset of field: ", stringify!(_FT_SETUP_PACKET), "::", stringify!(wLength) ) ); } ``` -------------------------------- ### FT_GetPipeInformation Function Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/prelude/index.html Re-exports the FT_GetPipeInformation function, used to get information about a pipe. ```APIDOC ## FT_GetPipeInformation ### Description Retrieves information about a specific USB pipe on the FTDI device. ### Signature `pub fn FT_GetPipeInformation(handle: FT_HANDLE, pipe: u8, pipe_type: *mut u8, pipe_id: *mut u8) -> FT_STATUS` ``` -------------------------------- ### Default value for Option<T> Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/type.FT_NOTIFICATION_CALLBACK.html Shows how to get the default value for an Option<T>, which is always None. ```rust let opt: Option<u32> = Option::default(); assert!(opt.is_none()); ``` -------------------------------- ### and Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/type.FT_NOTIFICATION_CALLBACK.html Returns None if the option is None, otherwise returns optb. Arguments passed to and are eagerly evaluated. ```APIDOC ## pub fn and<U>(self, optb: Option<U>) -> Option<U> ### Description Returns `None` if the option is `None`, otherwise returns `optb`. Arguments passed to `and` are eagerly evaluated; if you are passing the result of a function call, it is recommended to use `and_then`, which is lazily evaluated. ### Examples ```rust let x = Some(2); let y: Option<&str> = None; assert_eq!(x.and(y), None); let x: Option<u32> = None; let y = Some("foo"); assert_eq!(x.and(y), None); let x = Some(2); let y = Some("foo"); assert_eq!(x.and(y), Some("foo")); let x: Option<u32> = None; let y: Option<&str> = None; assert_eq!(x.and(y), None); ``` ``` -------------------------------- ### FT_GetDeviceInfoDetail Function Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/prelude/index.html Re-exports the FT_GetDeviceInfoDetail function, used to get detailed information about a specific device. ```APIDOC ## FT_GetDeviceInfoDetail ### Description Retrieves detailed information about a specific FTDI device by its index. ### Signature `pub fn FT_GetDeviceInfoDetail(index: u32, deviceid: *mut u32, vendorid: *mut u16, productid: *mut u16, serialnumber: *mut u8, description: *mut u8, latency_timer: *mut u8) -> FT_STATUS` ``` -------------------------------- ### Configuration and Control Functions Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/all.html Functions for configuring device settings, GPIO pins, and notifications. ```APIDOC ## FT_GetConfigurationDescriptor ### Description Retrieves the configuration descriptor for the FTDI device. ### Function Signature `FT_GetConfigurationDescriptor(...)` ### Parameters (Details not provided in source) ### Returns (Details not provided in source) ``` ```APIDOC ## FT_GetDescriptor ### Description Retrieves a specific descriptor from the FTDI device. ### Function Signature `FT_GetDescriptor(...)` ### Parameters (Details not provided in source) ### Returns (Details not provided in source) ``` ```APIDOC ## FT_GetStringDescriptor ### Description Retrieves a string descriptor from the FTDI device. ### Function Signature `FT_GetStringDescriptor(...)` ### Parameters (Details not provided in source) ### Returns (Details not provided in source) ``` ```APIDOC ## FT_GetChipConfiguration ### Description Retrieves the chip configuration of the FTDI device. ### Function Signature `FT_GetChipConfiguration(...)` ### Parameters (Details not provided in source) ### Returns (Details not provided in source) ``` ```APIDOC ## FT_SetChipConfiguration ### Description Sets the chip configuration of the FTDI device. ### Function Signature `FT_SetChipConfiguration(...)` ### Parameters (Details not provided in source) ### Returns (Details not provided in source) ``` ```APIDOC ## FT_GetGPIO ### Description Reads the state of a General Purpose Input/Output (GPIO) pin. ### Function Signature `FT_GetGPIO(...)` ### Parameters (Details not provided in source) ### Returns (Details not provided in source) ``` ```APIDOC ## FT_SetGPIO ### Description Sets the state of a General Purpose Input/Output (GPIO) pin. ### Function Signature `FT_SetGPIO(...)` ### Parameters (Details not provided in source) ### Returns (Details not provided in source) ``` ```APIDOC ## FT_WriteGPIO ### Description Writes a value to a General Purpose Input/Output (GPIO) pin. ### Function Signature `FT_WriteGPIO(...)` ### Parameters (Details not provided in source) ### Returns (Details not provided in source) ``` ```APIDOC ## FT_EnableGPIO ### Description Enables or disables a General Purpose Input/Output (GPIO) pin. ### Function Signature `FT_EnableGPIO(...)` ### Parameters (Details not provided in source) ### Returns (Details not provided in source) ``` ```APIDOC ## FT_SetGPIOPull ### Description Sets the pull-up or pull-down resistor configuration for a GPIO pin. ### Function Signature `FT_SetGPIOPull(...)` ### Parameters (Details not provided in source) ### Returns (Details not provided in source) ``` ```APIDOC ## FT_SetNotificationCallback ### Description Sets a callback function to be invoked upon specific events. ### Function Signature `FT_SetNotificationCallback(...)` ### Parameters (Details not provided in source) ### Returns (Details not provided in source) ``` ```APIDOC ## FT_ClearNotificationCallback ### Description Clears the previously set notification callback function. ### Function Signature `FT_ClearNotificationCallback(...)` ### Parameters (Details not provided in source) ### Returns (Details not provided in source) ``` ```APIDOC ## FT_SetTransferParams ### Description Sets parameters for data transfers. ### Function Signature `FT_SetTransferParams(...)` ### Parameters (Details not provided in source) ### Returns (Details not provided in source) ``` ```APIDOC ## FT_GetPipeInformation ### Description Retrieves information about a specific pipe. ### Function Signature `FT_GetPipeInformation(...)` ### Parameters (Details not provided in source) ### Returns (Details not provided in source) ``` ```APIDOC ## FT_GetInterfaceDescriptor ### Description Retrieves the interface descriptor for the FTDI device. ### Function Signature `FT_GetInterfaceDescriptor(...)` ### Parameters (Details not provided in source) ### Returns (Details not provided in source) ``` -------------------------------- ### FT_Create Source: https://docs.rs/libftd3xx-ffi/0.0.2/index.html Creates a handle to an FTDI device. ```APIDOC ## FT_Create ### Description Creates a handle to an FTDI device based on the specified open-by-type parameter. This is typically the first step in interacting with a device. ### Method (Not specified, likely a C function call) ### Endpoint (Not applicable) ### Parameters - **pvArg1** (LPVOID) - Required - Argument for opening the device (e.g., device index, serial number, description, GUID, location). - **pvArg2** (LPVOID) - Required - Argument for opening the device (used in conjunction with pvArg1 depending on the open-by-type). - **ftdiHandle** (PFT_HANDLE) - Required - Pointer to an FT_HANDLE that will receive the handle to the opened device. ### Request Example (Not applicable) ### Response #### Success Response (FT_STATUS) - **FT_OK** - Indicates the operation was successful. - Other FT_STATUS codes indicate specific errors. #### Response Example (Not applicable) ``` -------------------------------- ### FT_CreateDeviceInfoList Source: https://docs.rs/libftd3xx-ffi/0.0.2/index.html Creates a list of connected FTDI devices. ```APIDOC ## FT_CreateDeviceInfoList ### Description Populates a list with information about all connected FTDI devices. This allows the application to enumerate and select devices. ### Method (Not specified, likely a C function call) ### Endpoint (Not applicable) ### Parameters - **dest** (PFT_DEVICE_LIST_INFO_NODE) - Required - Pointer to an array of FT_DEVICE_LIST_INFO_NODE structures to be filled with device information. - **numDevices** (PULONG) - Required - Pointer to a ULONG that will receive the number of devices found. ### Request Example (Not applicable) ### Response #### Success Response (FT_STATUS) - **FT_OK** - Indicates the operation was successful. - Other FT_STATUS codes indicate specific errors. #### Response Example (Not applicable) ``` -------------------------------- ### Bindgen Test for _FT_SETUP_PACKET Layout Source: https://docs.rs/libftd3xx-ffi/0.0.2/src/libftd3xx_ffi/bindings_linux_x64.rs.html Verifies the memory layout and alignment of the _FT_SETUP_PACKET struct using bindgen's testing utilities. ```rust #[test] fn bindgen_test_layout__FT_SETUP_PACKET() { const UNINIT: ::std::mem::MaybeUninit<_FT_SETUP_PACKET> = ::std::mem::MaybeUninit::uninit(); let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::<_FT_SETUP_PACKET>(), 8usize, concat!("Size of: ", stringify!(_FT_SETUP_PACKET)) ); assert_eq!( ::std::mem::align_of::<_FT_SETUP_PACKET>(), 2usize, concat!("Alignment of ", stringify!(_FT_SETUP_PACKET)) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).RequestType) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", stringify!(_FT_SETUP_PACKET), "::", stringify!(RequestType) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).Request) as usize - ptr as usize }, 1usize, concat!( "Offset of field: ", stringify!(_FT_SETUP_PACKET), "::", stringify!(Request) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).Value) as usize - ptr as usize }, 2usize, concat!( "Offset of field: ", stringify!(_FT_SETUP_PACKET), "::", stringify!(Value) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).Index) as usize - ptr as usize }, 4usize, concat!( "Offset of field: ", stringify!(_FT_SETUP_PACKET), "::", stringify!(Index) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).Length) as usize - ptr as usize }, 6usize, concat!( "Offset of field: ", stringify!(_FT_SETUP_PACKET), "::", stringify!(Length) ) ); } ``` -------------------------------- ### Using get_or_try_insert_with for fallible insertions Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/type.FT_NOTIFICATION_CALLBACK.html Demonstrates the experimental get_or_try_insert_with for inserting a value from a fallible closure, handling potential errors. ```Rust #![feature(option_get_or_try_insert_with)] let mut o1: Option<u32> = None; let mut o2: Option<u8> = None; let number = "12345"; assert_eq!(o1.get_or_try_insert_with(|| number.parse()).copied(), Ok(12345)); assert!(o2.get_or_try_insert_with(|| number.parse()).is_err()); assert_eq!(o1, Some(12345)); assert_eq!(o2, None); ``` -------------------------------- ### Using replace to swap values in an Option Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/type.FT_NOTIFICATION_CALLBACK.html Demonstrates the replace method, which swaps the value in an Option with a new value, returning the old value. ```Rust let mut x = Some(2); let old = x.replace(5); assert_eq!(x, Some(5)); assert_eq!(old, Some(2)); ``` -------------------------------- ### FT_CreateDeviceInfoList Source: https://docs.rs/libftd3xx-ffi/0.0.2/src/libftd3xx_ffi/bindings_linux_x64.rs.html Creates a list of connected FTDI devices and returns the number of devices found. ```APIDOC ## FT_CreateDeviceInfoList ### Description Creates a list of connected FTDI devices and returns the number of devices found. ### Function Signature ```c FT_STATUS FT_CreateDeviceInfoList(LPDWORD lpdwNumDevs); ``` ### Parameters - **lpdwNumDevs** (LPDWORD) - Pointer to a DWORD that receives the number of devices found. ``` -------------------------------- ### Zipping two Options Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/type.FT_NOTIFICATION_CALLBACK.html Shows how to use the `zip` method to combine two Options into a single Option containing a tuple of their values if both are Some. ```rust let x = Some(1); let y = Some("hi"); let z = None::<u8>; assert_eq!(x.zip(y), Some((1, "hi"))); assert_eq!(x.zip(z), None); ``` -------------------------------- ### FT_GetFirmwareVersion Function Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/fn.FT_GetFirmwareVersion.html This function retrieves the firmware version of a connected device. It requires a handle to the device and a pointer to store the firmware version. ```APIDOC ## FT_GetFirmwareVersion ### Description Retrieves the firmware version of a connected device. ### Signature ```rust pub unsafe extern "C" fn FT_GetFirmwareVersion( ftHandle: FT_HANDLE, pulFirmwareVersion: PULONG, ) -> FT_STATUS ``` ### Parameters * **ftHandle** (FT_HANDLE) - A handle to the opened USB device. * **pulFirmwareVersion** (PULONG) - A pointer to a ULONG that will receive the firmware version. ### Return Value * **FT_STATUS** - Indicates success or failure of the operation. ``` -------------------------------- ### FT_ListDevices Source: https://docs.rs/libftd3xx-ffi/0.0.2/index.html Lists available FTDI devices. ```APIDOC ## FT_ListDevices ### Description Lists the available FTDI devices connected to the system. This function can return device information such as serial numbers or descriptions. ### Method (Not specified, likely a C function call) ### Endpoint (Not applicable) ### Parameters - **pcBuf** (LPVOID) - Optional - Pointer to a buffer to store device information. If NULL, the function returns the number of devices. - **pdwNumDevices** (LPDWORD) - Required - Pointer to a DWORD that will receive the number of devices found or the size of the buffer if pcBuf is provided. - **dwFlags** (DWORD) - Required - Flags to specify the type of information to retrieve (e.g., FT_LIST_NUMBER_ONLY, FT_LIST_BY_INDEX, FT_LIST_ALL). ### Request Example (Not applicable) ### Response #### Success Response (FT_STATUS) - **FT_OK** - Indicates the operation was successful. - Other FT_STATUS codes indicate specific errors. #### Response Example (Not applicable) ``` -------------------------------- ### FT_CreateDeviceInfoList Function Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/prelude/index.html Re-exports the FT_CreateDeviceInfoList function, used to create a list of device information. ```APIDOC ## FT_CreateDeviceInfoList ### Description Creates a list containing information about all connected FTDI devices. ### Signature `pub fn FT_CreateDeviceInfoList(devicelist: *mut FT_DEVICE_INFO_LIST) -> FT_STATUS` ``` -------------------------------- ### FT_GetOverlappedResult Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi Retrieves the results of an overlapped I/O operation. This function is used with asynchronous I/O operations to get completion status and bytes transferred. ```APIDOC ## FT_GetOverlappedResult ### Description Retrieves the results of an overlapped I/O operation. This function is used with asynchronous I/O operations to get completion status and bytes transferred. ### Method (Not specified, likely a C function call) ### Endpoint (Not applicable) ### Parameters (Parameters not explicitly detailed in the source) ### Request Example (Not applicable) ### Response (Response details not explicitly detailed in the source) ``` -------------------------------- ### Verify FT_60XCONFIGURATION Structure Size and Alignment Source: https://docs.rs/libftd3xx-ffi/0.0.2/src/libftd3xx_ffi/bindings_linux_x64.rs.html These assertions check the size and alignment of the FT_60XCONFIGURATION structure. Ensure these match expected values for correct FFI usage. ```rust assert_eq!( ::std::mem::size_of::<FT_60XCONFIGURATION>(), 1024, concat!("Size of: ", stringify!(FT_60XCONFIGURATION)) ); assert_eq!( ::std::mem::align_of::<FT_60XCONFIGURATION>(), 4usize, concat!("Alignment of ", stringify!(FT_60XCONFIGURATION)) ); ``` -------------------------------- ### Using or_else with Options Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/type.FT_NOTIFICATION_CALLBACK.html Demonstrates how to use the or_else method to provide a default Option value if the original Option is None. ```Rust assert_eq!(Some("barbarians").or_else(vikings), Some("barbarians")); assert_eq!(None.or_else(vikings), Some("vikings")); assert_eq!(None.or_else(nobody), None); ``` -------------------------------- ### Version and Status Functions Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/all.html Functions for retrieving library and driver versions, and checking device status. ```APIDOC ## FT_GetLibraryVersion ### Description Retrieves the version of the libftd3xx library. ### Function Signature `FT_GetLibraryVersion(...)` ### Parameters (Details not provided in source) ### Returns (Details not provided in source) ``` ```APIDOC ## FT_GetDriverVersion ### Description Retrieves the version of the FTDI driver. ### Function Signature `FT_GetDriverVersion(...)` ### Parameters (Details not provided in source) ### Returns (Details not provided in source) ``` ```APIDOC ## FT_GetFirmwareVersion ### Description Retrieves the firmware version of the FTDI device. ### Function Signature `FT_GetFirmwareVersion(...)` ### Parameters (Details not provided in source) ### Returns (Details not provided in source) ``` -------------------------------- ### FT_InitializeOverlapped Source: https://docs.rs/libftd3xx-ffi/0.0.2/index.html Initializes an OVERLAPPED structure for asynchronous I/O. ```APIDOC ## FT_InitializeOverlapped ### Description Initializes an OVERLAPPED structure, which is used for asynchronous (overlapped) I/O operations. This function prepares the structure for use with functions like FT_ReadPipeAsync and FT_WritePipeAsync. ### Method (Not specified, likely a C function call) ### Endpoint (Not applicable) ### Parameters - **overlapped** (LPOVERLAPPED) - Required - Pointer to the OVERLAPPED structure to initialize. ### Request Example (Not applicable) ### Response #### Success Response (FT_STATUS) - **FT_OK** - Indicates the operation was successful. - Other FT_STATUS codes indicate specific errors. #### Response Example (Not applicable) ``` -------------------------------- ### Option<T> Sum Example Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/type.FT_NOTIFICATION_CALLBACK.html Shows how to use the Sum trait with Option<T> to sum values from an iterator. The operation returns None if any element does not contain the target character. ```rust let words = vec!["have", "a", "great", "day"]; let total: Option<usize> = words.iter().map(|w| w.find('a')).sum(); ``` -------------------------------- ### Using xor for Exclusive Options Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/type.FT_NOTIFICATION_CALLBACK.html Illustrates the xor method, which returns Some if exactly one of the two Options is Some, and None otherwise. ```Rust let x = Some(2); let y: Option<u32> = None; assert_eq!(x.xor(y), Some(2)); let x: Option<u32> = None; let y = Some(2); assert_eq!(x.xor(y), Some(2)); let x = Some(2); let y = Some(2); assert_eq!(x.xor(y), None); let x: Option<u32> = None; let y: Option<u32> = None; assert_eq!(x.xor(y), None); ``` -------------------------------- ### Get libftd2xx C Library Version Source: https://docs.rs/libftd3xx/latest/libftd3xx/fn.library_version.html Call the `library_version` function to obtain the version of the underlying C library. This function is noted to work on Linux despite documentation suggesting Windows-only support. ```rust use libftd2xx::library_version; let version = library_version()?; println!("libftd2xx C library version: {}", version); ``` -------------------------------- ### FT_GetFirmwareVersion Function Signature Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/fn.FT_GetFirmwareVersion.html This is the unsafe C-style function signature for FT_GetFirmwareVersion as exposed by the libftd3xx_ffi crate. It takes a device handle and a pointer to a ULONG for the firmware version, returning an FT_STATUS. ```rust pub unsafe extern "C" fn FT_GetFirmwareVersion( ftHandle: FT_HANDLE, pulFirmwareVersion: PULONG, ) -> FT_STATUS ``` -------------------------------- ### Get Read Queue Status Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/fn.FT_GetReadQueueStatus.html This function retrieves the number of bytes currently in the read queue for a specified device. It requires a handle to the device, the FIFO ID, and a pointer to a DWORD to store the queue status. ```rust pub unsafe extern "C" fn FT_GetReadQueueStatus( ftHandle: FT_HANDLE, ucFifoID: UCHAR, lpdwAmountInQueue: LPDWORD, ) -> FT_STATUS ``` -------------------------------- ### take Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/type.FT_NOTIFICATION_CALLBACK.html Takes the value out of the option, leaving a `None` in its place. ```APIDOC ## pub const fn take(&mut self) -> Option<T> Takes the value out of the option, leaving a `None` in its place. ### Description This method removes the value from the `Option`, returning the contained value if it was `Some`, and leaving `None` in its place. If the `Option` was already `None`, it remains `None` and `None` is returned. ### Parameters * `&mut self` - A mutable reference to the Option. ### Response * `Option<T>` - The value that was previously in the Option, or `None` if the Option was `None`. ### Example ```rust let mut x = Some(2); let y = x.take(); assert_eq!(x, None); assert_eq!(y, Some(2)); let mut x: Option<u32> = None; let y = x.take(); assert_eq!(x, None); assert_eq!(y, None); ``` ``` -------------------------------- ### FT_GetDeviceInfoList Function Signature Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/fn.FT_GetDeviceInfoList.html This is the raw FFI function signature for FT_GetDeviceInfoList. It is unsafe and requires careful handling of pointers and device counts. ```rust pub unsafe extern "C" fn FT_GetDeviceInfoList( ptDest: *mut FT_DEVICE_LIST_INFO_NODE, lpdwNumDevs: LPDWORD, ) -> FT_STATUS ``` -------------------------------- ### FT_ControlTransfer Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/fn.FT_ControlTransfer.html The FT_ControlTransfer function allows for direct control of USB devices by sending and receiving control packets. It requires a handle to the device, setup packet information, a buffer for data transfer, the buffer length, and a pointer to store the number of bytes transferred. It returns an FT_STATUS code indicating success or failure. ```APIDOC ## FT_ControlTransfer ### Description Performs a USB control transfer. This is a low-level function for interacting directly with the USB device's control endpoint. ### Signature ``` pub unsafe extern "C" fn FT_ControlTransfer( ftHandle: FT_HANDLE, tSetupPacket: FT_SETUP_PACKET, pucBuffer: PUCHAR, ulBufferLength: ULONG, pulLengthTransferred: PULONG, ) -> FT_STATUS ``` ### Parameters * `ftHandle` (FT_HANDLE): A handle to the USB device. * `tSetupPacket` (FT_SETUP_PACKET): A structure containing the setup packet information for the control transfer. * `pucBuffer` (PUCHAR): A pointer to a buffer that will hold the data to be sent or received. * `ulBufferLength` (ULONG): The size of the buffer in bytes. * `pulLengthTransferred` (PULONG): A pointer to a ULONG variable that will receive the number of bytes actually transferred. ### Returns * `FT_STATUS`: An enumeration value indicating the success or failure of the operation. Common values include FT_OK for success. ``` -------------------------------- ### FT_ControlTransfer Function Signature Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/fn.FT_ControlTransfer.html The unsafe extern "C" function signature for FT_ControlTransfer. This function is used to perform control transfers to a USB device. It requires a handle to the device, setup packet details, a buffer for data, the buffer length, and a pointer to store the number of bytes transferred. It returns an FT_STATUS code indicating success or failure. ```rust pub unsafe extern "C" fn FT_ControlTransfer( ftHandle: FT_HANDLE, tSetupPacket: FT_SETUP_PACKET, pucBuffer: PUCHAR, ulBufferLength: ULONG, pulLengthTransferred: PULONG, ) -> FT_STATUS ``` -------------------------------- ### FT_InitializeOverlapped Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/fn.FT_InitializeOverlapped.html Initializes overlapped I/O operations for a given device handle. This function is unsafe and requires careful handling of pointers and status codes. ```APIDOC ## FT_InitializeOverlapped ### Description Initializes overlapped I/O operations for a given device handle. This function is unsafe and requires careful handling of pointers and status codes. ### Signature ```rust pub unsafe extern "C" fn FT_InitializeOverlapped( ftHandle: FT_HANDLE, pOverlapped: LPOVERLAPPED, ) -> FT_STATUS ``` ### Parameters * **ftHandle** (`FT_HANDLE`): A handle to the device for which to initialize overlapped I/O. * **pOverlapped** (`LPOVERLAPPED`): A pointer to an OVERLAPPED structure that will be used for asynchronous operations. ### Return Value * **FT_STATUS**: Returns a status code indicating the result of the operation. Refer to the libftd3xx documentation for specific status codes. ``` -------------------------------- ### Using insert to add or replace a value Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/type.FT_NOTIFICATION_CALLBACK.html Shows how to use the insert method to add a value to an Option or replace an existing one, returning a mutable reference. ```Rust let mut opt = None; let val = opt.insert(1); assert_eq!(*val, 1); assert_eq!(opt.unwrap(), 1); let val = opt.insert(2); assert_eq!(*val, 2); *val = 3; assert_eq!(opt.unwrap(), 3); ``` -------------------------------- ### Clone To Uninit Implementation (Nightly) Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/struct._FT_COMMON_DESCRIPTOR.html An experimental nightly-only feature that allows cloning data into an uninitialized memory location. Use with caution as it is unsafe. ```rust unsafe fn clone_to_uninit(&self, dest: *mut u8) ``` -------------------------------- ### FT_CreateDeviceInfoList Function Signature Source: https://docs.rs/libftd3xx-ffi/0.0.2/libftd3xx_ffi/fn.FT_CreateDeviceInfoList.html This snippet shows the unsafe extern "C" function signature for FT_CreateDeviceInfoList. It takes a mutable pointer to a DWORD (LPDWORD) and returns an FT_STATUS. ```rust pub unsafe extern "C" fn FT_CreateDeviceInfoList( lpdwNumDevs: LPDWORD, ) -> FT_STATUS ```