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 default configs using derive_impl #4827

Open
gupnik opened this issue Jun 19, 2024 · 0 comments
Open

Custom default configs using derive_impl #4827

gupnik opened this issue Jun 19, 2024 · 0 comments
Assignees
Labels
T1-FRAME This PR/Issue is related to core FRAME, the framework.

Comments

@gupnik
Copy link
Contributor

gupnik commented Jun 19, 2024

As @kianenigma suggested in this comment, we should be able to provide custom default configs and use derive_impl to share those across runtimes.

The following could be possible way:

pub trait CustomDefaultConfigProvider {
	type RuntimeOrigin;
	type RuntimeCall;
	type RuntimeTask;
}

pub struct CustomDefaultConfig;

#[crate::register_default_impl(CustomDefaultConfig)]
impl CustomDefaultConfigProvider for CustomDefaultConfig {
	#[inject_runtime_type]
	type RuntimeOrigin = ();
	#[inject_runtime_type]
	type RuntimeCall = ();
	#[inject_runtime_type]
	type RuntimeTask = ();
}

struct Runtime;

#[derive_impl(CustomDefaultConfig, no_aggregated_types)
impl Config for Runtime {}

If this works, we should add some documentation (ideally using docify) on how to use it.

@gupnik gupnik added the T1-FRAME This PR/Issue is related to core FRAME, the framework. label Jun 19, 2024
@gupnik gupnik self-assigned this Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T1-FRAME This PR/Issue is related to core FRAME, the framework.
Projects
None yet
Development

No branches or pull requests

1 participant