mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-19 19:21:03 +00:00
Finish documenting #[pallet::xxx] macros (#2638)
Closes https://github.com/paritytech/polkadot-sdk-docs/issues/35 - Moves pallet proc macro docs to `frame_support` - Adds missing docs - Revise revise existing docs, adding compiling doctests where appropriate --------- Co-authored-by: command-bot <> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
Generated
+1
@@ -5750,6 +5750,7 @@ dependencies = [
|
|||||||
"sp-staking",
|
"sp-staking",
|
||||||
"sp-state-machine",
|
"sp-state-machine",
|
||||||
"sp-std 14.0.0",
|
"sp-std 14.0.0",
|
||||||
|
"sp-timestamp",
|
||||||
"sp-tracing 16.0.0",
|
"sp-tracing 16.0.0",
|
||||||
"sp-weights",
|
"sp-weights",
|
||||||
"static_assertions",
|
"static_assertions",
|
||||||
|
|||||||
@@ -250,14 +250,16 @@
|
|||||||
// of event is probably not the best.
|
// of event is probably not the best.
|
||||||
//!
|
//!
|
||||||
//! With the explanation out of the way, let's see how these components can be added. Both follow a
|
//! With the explanation out of the way, let's see how these components can be added. Both follow a
|
||||||
//! fairly familiar syntax: normal Rust enums, with an extra `#[frame::event/error]` attribute
|
//! fairly familiar syntax: normal Rust enums, with extra
|
||||||
//! attached.
|
//! [`#[frame::event]`](frame::pallet_macros::event) and
|
||||||
|
//! [`#[frame::error]`](frame::pallet_macros::error) attributes attached.
|
||||||
#![doc = docify::embed!("./src/guides/your_first_pallet/mod.rs", Event)]
|
#![doc = docify::embed!("./src/guides/your_first_pallet/mod.rs", Event)]
|
||||||
#![doc = docify::embed!("./src/guides/your_first_pallet/mod.rs", Error)]
|
#![doc = docify::embed!("./src/guides/your_first_pallet/mod.rs", Error)]
|
||||||
//!
|
//!
|
||||||
//! One slightly custom part of this is the `#[pallet::generate_deposit(pub(super) fn
|
//! One slightly custom part of this is the [`#[pallet::generate_deposit(pub(super) fn
|
||||||
//! deposit_event)]` part. Without going into too much detail, in order for a pallet to emit events
|
//! deposit_event)]`](frame::pallet_macros::generate_deposit) part. Without going into too
|
||||||
//! to the rest of the system, it needs to do two things:
|
//! much detail, in order for a pallet to emit events to the rest of the system, it needs to do two
|
||||||
|
//! things:
|
||||||
//!
|
//!
|
||||||
//! 1. Declare a type in its `Config` that refers to the overarching event type of the runtime. In
|
//! 1. Declare a type in its `Config` that refers to the overarching event type of the runtime. In
|
||||||
//! short, by doing this, the pallet is expressing an important bound: `type RuntimeEvent:
|
//! short, by doing this, the pallet is expressing an important bound: `type RuntimeEvent:
|
||||||
@@ -266,7 +268,8 @@
|
|||||||
//! store it where needed.
|
//! store it where needed.
|
||||||
//!
|
//!
|
||||||
//! 2. But, doing this conversion and storing is too much to expect each pallet to define. FRAME
|
//! 2. But, doing this conversion and storing is too much to expect each pallet to define. FRAME
|
||||||
//! provides a default way of storing events, and this is what `pallet::generate_deposit` is doing.
|
//! provides a default way of storing events, and this is what
|
||||||
|
//! [`pallet::generate_deposit`](frame::pallet_macros::generate_deposit) is doing.
|
||||||
#![doc = docify::embed!("./src/guides/your_first_pallet/mod.rs", config_v2)]
|
#![doc = docify::embed!("./src/guides/your_first_pallet/mod.rs", config_v2)]
|
||||||
//!
|
//!
|
||||||
//! > These `Runtime*` types are better explained in
|
//! > These `Runtime*` types are better explained in
|
||||||
@@ -280,8 +283,9 @@
|
|||||||
#![doc = docify::embed!("./src/guides/your_first_pallet/mod.rs", runtime_v2)]
|
#![doc = docify::embed!("./src/guides/your_first_pallet/mod.rs", runtime_v2)]
|
||||||
//!
|
//!
|
||||||
//! In this snippet, the actual `RuntimeEvent` type (right hand side of `type RuntimeEvent =
|
//! In this snippet, the actual `RuntimeEvent` type (right hand side of `type RuntimeEvent =
|
||||||
//! RuntimeEvent`) is generated by `construct_runtime`. An interesting way to inspect this type is
|
//! RuntimeEvent`) is generated by
|
||||||
//! to see its definition in rust-docs:
|
//! [`construct_runtime`](frame::runtime::prelude::construct_runtime). An interesting way to inspect
|
||||||
|
//! this type is to see its definition in rust-docs:
|
||||||
//! [`crate::guides::your_first_pallet::pallet_v2::tests::runtime_v2::RuntimeEvent`].
|
//! [`crate::guides::your_first_pallet::pallet_v2::tests::runtime_v2::RuntimeEvent`].
|
||||||
//!
|
//!
|
||||||
//!
|
//!
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ aquamarine = { version = "0.5.0" }
|
|||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
assert_matches = "1.3.0"
|
assert_matches = "1.3.0"
|
||||||
pretty_assertions = "1.2.1"
|
pretty_assertions = "1.2.1"
|
||||||
|
sp-timestamp = { path = "../../primitives/timestamp", default-features = false }
|
||||||
frame-system = { path = "../system" }
|
frame-system = { path = "../system" }
|
||||||
sp-crypto-hashing = { path = "../../primitives/crypto/hashing" }
|
sp-crypto-hashing = { path = "../../primitives/crypto/hashing" }
|
||||||
|
|
||||||
@@ -96,6 +97,7 @@ std = [
|
|||||||
"sp-std/std",
|
"sp-std/std",
|
||||||
"sp-tracing/std",
|
"sp-tracing/std",
|
||||||
"sp-weights/std",
|
"sp-weights/std",
|
||||||
|
"sp-timestamp/std"
|
||||||
]
|
]
|
||||||
runtime-benchmarks = [
|
runtime-benchmarks = [
|
||||||
"frame-system/runtime-benchmarks",
|
"frame-system/runtime-benchmarks",
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
+1000
-1359
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user