/// Invokes a remote function call to a Flipper device.
///
/// All functions belong to a module, whether it's a Standard Module or a
/// User Module. The module's FFI representation must be given in order
/// for libflipper to find the module where the function resides.
/// Within a module, functions are ordered by index, so the index of the
/// desired function within the given module must be given. Then, the
/// desired arguments with which to execute the function must be given.
/// The arguments are type-sensitive and order-sensitive. Finally, the
/// return type of `lf_invoke` must be bound with a type parameter, so
/// that the FMR system can know what type to deliver back to Rust.
///
/// Consider the following C function, which belongs to a Flipper module.
///
/// ```c
/// uint8_t foo(uint16_t bar, uint32_t baz, uint64_t qux);
/// ```
///
/// To execute this function using `lf_invoke` would look like this:
///
/// ```
/// use flipper::{ModuleFFI, UserModuleFFI};
/// use flipper::fmr::{Args, lf_invoke};
///
/// // Don't do this, this is just to get the doc tests to compile.
/// // See how to create a user module.
/// let ffi = ModuleFFI::User(UserModuleFFI::uninitialized("some_module"));
///
/// let args = Args::new()
///                .append(10 as u16)  // bar
///                .append(20 as u32)  // baz
///                .append(30 as u64); // qux
///
/// let output: u8 = lf_invoke(&ffi, 0, args);
/// ```
Invokes a remote function call to a Flipper device.
All functions belong to a module, whether it's a Standard Module or a
User Module. The module's FFI representation must be given in order
for libflipper to find the module where the function resides.
Within a module, functions are ordered by index, so the index of the
desired function within the given module must be given. Then, the
desired arguments with which to execute the function must be given.
The arguments are type-sensitive and order-sensitive. Finally, the
return type of `lf_invoke` must be bound with a type parameter, so
that the FMR system can know what type to deliver back to Rust.

Consider the following C function, which belongs to a Flipper module.



To execute this function using `lf_invoke` would look like this.



Don't do this, this is just to get the doc tests to compile.
See how to create a user module.




Invokes a remote function call to a Flipper device . All functions belong to a module whether it ' s a Standard Module or a User Module . The module ' s FFI representation must be given in order for libflipper to find the module where the function resides . Within a module functions are ordered by index so the index of the desired function within the given module must be given . Then the desired arguments with which to execute the function must be given . The arguments are type - sensitive and order - sensitive . Finally the return type of ` lf_invoke ` must be bound with a type parameter so that the FMR system can know what type to deliver back to Rust . Consider the following C function which belongs to a Flipper module . To execute this function using ` lf_invoke ` would look like this . Don ' t do this this is just to get the doc tests to compile . See how to create a user module .
pub fn lf_invoke<'a, T: LfReturnable>(module: &'a ModuleFFI, index: u8, args: Args) -> T {
    unsafe {
        let mut arglist: *mut _lf_ll = ptr::null_mut();
        for arg in args.iter() {
            libflipper::lf_ll_append(&mut arglist, &arg.0 as *const _lf_arg as *const c_void, ptr::null());
        }
        let ret = libflipper::lf_invoke(module.as_ptr(), index, T::lf_type(), arglist);
        T::from(LfReturn(ret))
    }
}
pub fn lf_invoke < ' a , T : LfReturnable > ( module : & ' a ModuleFFI , index : u8 , args : Args ) -> T { unsafe { let mut arglist : * mut _lf_ll = ptr :: null_mut ( ) ; for arg in args . iter ( ) { libflipper :: lf_ll_append ( & mut arglist , & arg . 0 as * const _lf_arg as * const c_void , ptr :: null ( ) ) ; } let ret = libflipper :: lf_invoke ( module . as_ptr ( ) , index , T :: lf_type ( ) , arglist ) ; T :: from ( LfReturn ( ret ) ) } }
Invokes a remote function call to a Flipper device.
Invokes a remote function call to a Flipper device .
module
&'a ModuleFFI
index
u8
args
Args