Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

pallet macro: easier syntax for #[pallet::pallet] with struct Pallet<T>(_) #8091

Merged
merged 3 commits into from
Feb 10, 2021

Conversation

gui1117
Copy link
Contributor

@gui1117 gui1117 commented Feb 9, 2021

This PR makes the declaration of pallet placeholder less boilerplatey.

now user can just write:

#[pallet::pallet]
pub struct Pallet<T>(_);

And the macro will replace _ with the expected PhantomData.

Note that this macro doesn't forbid to write it explicitly like:

#[pallet::pallet]
pub struct Pallet<T>(sp_std::maker::PhantomData<T>);

If this PR gets into before substrate 3.0 I guess we can forbid any other syntax than _. otherwise I guess better to let user choose.

@github-actions github-actions bot added the A0-please_review Pull request needs code review. label Feb 9, 2021
@gui1117 gui1117 added B3-apinoteworthy C1-low PR touches the given topic and has a low impact on builders. labels Feb 9, 2021
@gui1117 gui1117 merged commit 91a7418 into master Feb 10, 2021
@gui1117 gui1117 deleted the gui-pallet-underscore branch February 10, 2021 09:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. C1-low PR touches the given topic and has a low impact on builders.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants