-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Error] ReprC Implementation Not General Enough #38
Comments
As I look around, I'm getting the feeling that it's perfectly possible to implement |
Hey, I think using #[repr(C)]
#[derive(Clone, Copy)]
pub struct CHostFunctionPointers {
/// Get the full CBOR serialized [`ScriptApi`] including components discovered and
/// implemented by other language adapters or the dynamite host.
pub get_full_api: extern "C" fn(dynamite: *const Void) -> repr_c::Vec<u8>,
/// Call a function provided by the scripting API
call_function: extern "C" fn(
dynamite: *const Void,
path: str::Ref<'_>,
args: c_slice::Ref<'_, *const Void>,
) -> *const Void,
}
unsafe impl safer_ffi::layout::CType for CHostFunctionPointers {
type OPAQUE_KIND = safer_ffi::layout::OpaqueKind::Concrete;
}
unsafe impl safer_ffi::layout::ReprC for CHostFunctionPointers {
type CLayout = Self;
#[inline]
fn is_valid(_: &Self::CLayout) -> bool {
true
}
} I have no idea if it makes sense 😜. |
Yes, as you have correctly identified, this is an issue related to function pointer with different "higher-order-ness" requiring different generic signatures to be covered; see:
This is thus a known issue of I haven't release that officially since I need to untangle this kind of features with some development / experimental features present in the Temporary solution
An official release of |
Awesome! Thanks for the help! |
Good news, the changes from that experimental branch have made it to Closing this as completed, then 🙂 |
I'm getting an error with this example, is there anything I can do about it?
Apparently it works with
feature(trivial_bounds)
.Edit: I don't think the
trivial_bounds
feature fixes everything, actually.The text was updated successfully, but these errors were encountered: