add the ability to declare multiple impl blocks #6795
Draft
+411
−49
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Adds the ability to split single
impl_runtime_apis
into multiple modules throughsp_api::impl_runtime_apis_ext
.Example block would look like:
also see: #3067
Review Notes
The main difference between
impl_runtime_apis
andimpl_runtime_apis_ext
is the fact that the latter doesn't generate base runtime structures and doesn't track the imports to aggregate them inside themetadata
andruntime_api_versions
.TODOs:
RUNTIME_API_VERSION
was a
const
before, i've moved it to a standalone function inside the main impl block.The question is should it be tied to the runtime via trait e.g
RuntimeApiVersion
and if yes where should it go?(sp_api or sp_version)I've tried to figure out a way to use a
const
but given that all of theconst
declarations contain data inside astd::borrow::Cow
and and there's no way to get value out in const expression and i've failed to do so, if someone has any idea how to get around this i would really appreciate some input.