Skip to content
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

Custom trigger with other WASI worlds requires trait implementation for spin_core::Data<T> #2605

Closed
smndtrl opened this issue Jun 27, 2024 · 2 comments

Comments

@smndtrl
Copy link

smndtrl commented Jun 27, 2024

Trying to create a custom trigger, I'm unsuccessful with linking a custom world during the configure_engine step requires me to implement my WasiCustomView for spin_core::Data<CustomRuntimeData>. Implementing WasiCustomView for CustomRuntimeData is not enough. Am I missing something obvious here?

I'm using v2.6.0, wasmtime 21 and wasi_custom_rs also uses 21 for bindgen.

let _ = builder.link_import(| l, _| {
            wasi_custom_rs::add_custom_to_linker(l);
});
the trait bound `spin_core::Data<CustomRuntimeData>: WasiCustomView` is not satisfied
@lann
Copy link
Collaborator

lann commented Jun 27, 2024

This is a limitation of spin-core's design; you can't implement traits on Store's root data type, so an add_to_linker function that requires that won't work.

The upcoming "Spin Factors" design should work for your specific scenario (though only incidentally; the custom interface itself couldn't be a factor).

@smndtrl
Copy link
Author

smndtrl commented Jun 27, 2024

My bad. I tried to copy the add_to_linker pattern from other libraries like wasmtime-wasi-http and wasmtime-wasi. I'll try to find another way then.

@smndtrl smndtrl closed this as completed Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants