Support for cfg attributes in host functions definitions (#14189)

* Support cfg attribute in host functions definitions

* Added test to check feature gated methods are not included

* Versioned conditional compiled host function are forbidden

* Improve runtime-interface macro docs

* Fix doc

* Apply review suggestion

Co-authored-by: Koute <koute@users.noreply.github.com>

* Better error message

* Rust fmt

* More refinements to the docs

---------

Co-authored-by: Koute <koute@users.noreply.github.com>
This commit is contained in:
Davide Galassi
2023-05-25 13:27:34 +02:00
committed by GitHub
parent 7e8bfb7f55
commit 4185a213ac
6 changed files with 132 additions and 21 deletions
@@ -0,0 +1,18 @@
use sp_runtime_interface::runtime_interface;
#[runtime_interface]
trait Test {
fn foo() {}
#[cfg(feature = "bar-feature")]
fn bar() {}
#[cfg(not(feature = "bar-feature"))]
fn qux() {}
}
fn main() {
test::foo();
test::bar();
test::qux();
}