Skip to content
This repository has been archived by the owner on Aug 19, 2020. It is now read-only.
This repository has been archived by the owner on Aug 19, 2020. It is now read-only.

Explainer on function visibility in runtime pallets #16

Open
gnunicorn opened this issue Mar 31, 2020 · 2 comments
Open

Explainer on function visibility in runtime pallets #16

gnunicorn opened this issue Mar 31, 2020 · 2 comments
Labels
K1 - Runtime Info about the runtime. Q0 - Easy Small, easy topic to figure out, just need someone to do it. Good for newcomers. T2 - New Page Add a new page to the KB.

Comments

@gnunicorn
Copy link
Contributor

Explain the difference between fn in the define block and fn and pub fn in an extra impl-Block in a substrate pallet. Do they differ? How? Which one to use when?

@gnunicorn gnunicorn added Q0 - Easy Small, easy topic to figure out, just need someone to do it. Good for newcomers. T2 - New Page Add a new page to the KB. labels Mar 31, 2020
@gnunicorn gnunicorn changed the title Explainer on function visibility on runtime Explainer on function visibility in runtime pallets Mar 31, 2020
@gnunicorn gnunicorn added the K1 - Runtime Info about the runtime. label Mar 31, 2020
@JoshOrndorff
Copy link
Contributor

You mean the difference between

decl_module! {
	pub struct Module<T: Trait> for enum Call where origin: T::Origin {
		// These function
	}
}

and

impl<T: Trait> Module<T> {
	// These functions
}

@gnunicorn
Copy link
Contributor Author

gnunicorn commented Mar 31, 2020

yeah and more precisely on:

decl_module! {
	pub struct Module<T: Trait> for enum Call where origin: T::Origin {
		pub fn a() { }

		fn b(){ }
	}
}

impl<T: Trait> Module<T> {
	pub fn c() { }
	fn d() { }
}

the visibility of a, b, c and d to different parties.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
K1 - Runtime Info about the runtime. Q0 - Easy Small, easy topic to figure out, just need someone to do it. Good for newcomers. T2 - New Page Add a new page to the KB.
Projects
None yet
Development

No branches or pull requests

2 participants