You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While transitioning from the low api to the middle api, I found that there is no new_variadic function for Cif, which is a must for me. I can't create a pull request, so I'm pasting the function I created for myself here in hope that some variation of this function will be merged :)
/// Creates a new variadic [CIF](Cif) for the given argument and result/// types.////// Takes ownership of the argument and result [`Type`]s, because/// the resulting [`Cif`] retains references to them. Defaults to/// the platform’s default calling convention; this can be adjusted/// using [`Cif::set_abi`].pubfnnew_variadic<I>(args:I,fixed_args:usize,result:Type) -> SelfwhereI:IntoIterator<Item = Type>,I::IntoIter:ExactSizeIterator<Item = Type>,{let args = args.into_iter();let nargs = args.len();let args = types::TypeArray::new(args);letmut cif: low::ffi_cif = Default::default();unsafe{
low::prep_cif_var(&mut cif,
low::ffi_abi_FFI_DEFAULT_ABI,
fixed_args,
nargs,
result.as_raw_ptr(),
args.as_raw_ptr(),)}.expect("low::prep_cif_var");// Note that cif retains references to args and result,// which is why we hold onto them here.Cif{ cif, args, result }}
The text was updated successfully, but these errors were encountered:
While transitioning from the
low
api to themiddle
api, I found that there is nonew_variadic
function for Cif, which is a must for me. I can't create a pull request, so I'm pasting the function I created for myself here in hope that some variation of this function will be merged :)The text was updated successfully, but these errors were encountered: