1223: feat(runtime-core) Implement `TryFrom<native_type>` for `Value` r=Hywan a=Hywan
Extracted from #1018.
This PR implements `TryFrom` for `Value`. It is required to support dynamically-typed values for polymorphic host functions.
This PR also refactors the code by using a macro (`value_conversions!`) to implement `From` and `TryFrom` in one shot.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
Co-authored-by: Ivan Enderlin <ivan.enderlin@wanadoo.fr>
1224: fix(runtime-core) Remove warnings r=Hywan a=Hywan
Because we can use the `impl_traits!` macro with only one identifier,
a warning is emitted saying the parenthesis are useless for this
specific usecase. They are required for all the other usecases
though. We can safely ignore this warning.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
Co-authored-by: Ivan Enderlin <ivan.enderlin@wanadoo.fr>
1221: doc(interface-types) Add a `README.md` file r=MarkMcCaskey a=Hywan
Just a small `README.md`, so that users aren't totally loss.
Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
Those are not necessary for the user. It's only internal
implementation, that must be public because it ends up in public
types, but the compiler infers everything automatically.
This patch adds a new field in `Func`: `signature`. It contains the
signature of the host function.
For non-polymorphic host functions, the signature is computed from the
`Args` and `Rets` implementation parameters at compile-time.
For polymorphic host functions though, to be fully dynamic, the
signature given to `new_polymorphic` is used in `Func` as the correct
signature.
Because we can use the `impl_traits!` macro with only one identifier,
a warning is emitted saying the parenthesis are useless for this
specific usecase. They are required for all the other usecases
though. We can safely ignore this warning.