diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index c280b46d34..bc793af5dd 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -253,6 +253,7 @@ jobs: name: Check documentation and run doc tests runs-on: parity-large needs: [fmt, machete] + timeout-minutes: 30 steps: - name: Checkout sources uses: actions/checkout@v4 diff --git a/CHANGELOG.md b/CHANGELOG.md index 6cacf872de..a065df692d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,100 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.42.0] - 2025-05-09 + +The primary benefit of this release is introducing support for the [_about-to-be-stabilised-in-polkadot-sdk_](https://github.com/paritytech/polkadot-sdk/pull/8443) V16 metadata, and with that, support for calling Pallet View Functions on runtimes which will support this. Pallet View Functions are used much like Runtime APIs, except that they are declared in specific pallets and not declared at the runtime-wide level, allowing pallets to carry their own APIs with them. + +### Pallet View Functions + +Calling a Pallet View Function in this Subxt release will look like: + +```rust +use runtime::proxy::view_functions::check_permissions::{Call, ProxyType}; + +// Construct the call, providing the two arguments. +let view_function_call = runtime::view_functions() + .proxy() + .check_permissions( + Call::System(runtime::system::Call::remark { remark: b"hi".to_vec() }), + ProxyType::Any + ); + +// Submit the call and get back a result. +let _is_call_allowed = api + .view_functions() + .at_latest() + .await? + .call(view_function_call) + .await?; +``` + +Like Runtime APIs and others, the dynamic API can also be used to call into Pallet View Functions, which has the advantage of not needing the statically generated interface, but the downside of not being strongly typed. This looks like the following: + +```rust +use scale_value::value; + +let metadata = api.metadata(); + +// Look up the query ID for the View Function in the node metadata: +let query_id = metadata + .pallet_by_name("Proxy") + .unwrap() + .view_function_by_name("check_permissions") + .unwrap() + .query_id(); + +// Construct the call, providing the two arguments. +let view_function_call = subxt::dynamic::view_function_call( + *query_id, + vec![ + value!(System(remark(b"hi".to_vec()))), + value!(Any()) + ], +); + +// Submit the call and get back a result. +let _is_call_allowed = api + .view_functions() + .at_latest() + .await? + .call(view_function_call) + .await?; +``` + +### Updated `Config` trait + +Another change to be aware of is that [our `Config` trait has been tweaked](https://github.com/paritytech/subxt/pull/1974). The `Hash` associated type is no longer needed, as it can be obtained via the `Hasher` associated type already, and `PolkadotConfig`/`SubstrateConfig` now set the hasher by default to be `DynamicHasher256`, which will (when V16 metadata is available for a runtime) automatically select between Keccak256 and BlakeTwo256 hashers depending on what the chain requires. + +### Other changes + +We also [solidify our support for V1 archive RPCs](https://github.com/paritytech/subxt/pull/1977), [upgrade the codebase to Rust 2024 edition](https://github.com/paritytech/subxt/pull/2001), and a bunch of other changes, the full list of which is here: + +### Added + +- Support v16 metadata and use it by default if it's available ([#1999](https://github.com/paritytech/subxt/pull/1999)) +- Metadata V16: Implement support for Pallet View Functions ([#1981](https://github.com/paritytech/subxt/pull/1981)) +- Metadata V16: Be more dynamic over which hasher is used. ([#1974](https://github.com/paritytech/subxt/pull/1974)) + +### Changed + +- Update to 2024 edition ([#2001](https://github.com/paritytech/subxt/pull/2001)) +- Update Smoldot to latest version ([#1991](https://github.com/paritytech/subxt/pull/1991)) +- Update native test timeout to 45 mins ([#2002](https://github.com/paritytech/subxt/pull/2002)) +- chore(deps): tokio ^1.44.2 ([#1989](https://github.com/paritytech/subxt/pull/1989)) +- Add DefaultParams to allow more transaction extensions to be used when calling _default() methods ([#1979](https://github.com/paritytech/subxt/pull/1979)) +- Use wat instead of wabt to avoid CI cmake error (and use supported dep) ([#1980](https://github.com/paritytech/subxt/pull/1980)) +- Support v1 archive RPCs ([#1977](https://github.com/paritytech/subxt/pull/1977)) +- Support V16 metadata and refactor metadata code ([#1967](https://github.com/paritytech/subxt/pull/1967)) +- Allow submitting transactions ignoring follow events ([#1962](https://github.com/paritytech/subxt/pull/1962)) +- Improve error message regarding failure to extract metadata from WASM runtime ([#1961](https://github.com/paritytech/subxt/pull/1961)) +- Add docs for subxt-rpcs and fix example ([#1954](https://github.com/paritytech/subxt/pull/1954)) + +### Fixed + +- Fix CLI storage diff ([#1958](https://github.com/paritytech/subxt/pull/1958)) +- chore: fix some typos ([#1997](https://github.com/paritytech/subxt/pull/1997)) + ## [0.41.0] - 2025-03-10 This release makes two main changes: diff --git a/Cargo.lock b/Cargo.lock index 78f9e8c12a..9f77054b29 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "Inflector" @@ -53,7 +53,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" dependencies = [ "cfg-if", - "getrandom 0.3.2", + "getrandom 0.3.3", "once_cell", "version_check", "zerocopy", @@ -904,9 +904,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.2.21" +version = "1.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8691782945451c1c383942c4874dbe63814f61cb57ef773cda2972682b7bb3c0" +checksum = "32db95edf998450acc7881c932f94cd9b05c87b4b2599e8bab064753da4acfd1" dependencies = [ "jobserver", "libc", @@ -2139,9 +2139,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0" +checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" dependencies = [ "cfg-if", "libc", @@ -2845,7 +2845,7 @@ version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38f262f097c174adebe41eb73d66ae9c06b2844fb0da69969647bbddd9b0538a" dependencies = [ - "getrandom 0.3.2", + "getrandom 0.3.3", "libc", ] @@ -5881,7 +5881,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7437ac7763b9b123ccf33c338a5cc1bac6f69b45a136c19bdd8a65e3916435bf" dependencies = [ "fastrand", - "getrandom 0.3.2", + "getrandom 0.3.3", "once_cell", "rustix 1.0.7", "windows-sys 0.59.0", diff --git a/cli/src/commands/diff.rs b/cli/src/commands/diff.rs index 392bc8111d..a5f723f4db 100644 --- a/cli/src/commands/diff.rs +++ b/cli/src/commands/diff.rs @@ -18,7 +18,7 @@ use subxt_metadata::{ /// Explore the differences between two nodes /// /// # Example -/// ``` +/// ```text /// subxt diff ./artifacts/polkadot_metadata_small.scale ./artifacts/polkadot_metadata_tiny.scale /// subxt diff ./artifacts/polkadot_metadata_small.scale wss://rpc.polkadot.io:443 /// ``` diff --git a/cli/src/commands/explore/mod.rs b/cli/src/commands/explore/mod.rs index e3eb97fb17..6070c1adb8 100644 --- a/cli/src/commands/explore/mod.rs +++ b/cli/src/commands/explore/mod.rs @@ -20,6 +20,7 @@ mod runtime_apis; /// # Example /// /// Show the pallets and runtime apis that are available: +/// /// ```text /// subxt explore --file=polkadot_metadata.scale /// ``` diff --git a/cli/src/commands/explore/runtime_apis/mod.rs b/cli/src/commands/explore/runtime_apis/mod.rs index 730fb906f9..b291a2b95b 100644 --- a/cli/src/commands/explore/runtime_apis/mod.rs +++ b/cli/src/commands/explore/runtime_apis/mod.rs @@ -19,7 +19,7 @@ use subxt_metadata::RuntimeApiMetadata; /// Runs for a specified runtime API trait. /// Cases to consider: -/// ```txt +/// ```text /// method is: /// None => Show pallet docs + available methods /// Some (invalid) => Show Error + available methods diff --git a/codegen/src/api/constants.rs b/codegen/src/api/constants.rs index fbcfcbc544..7bc2b409d6 100644 --- a/codegen/src/api/constants.rs +++ b/codegen/src/api/constants.rs @@ -14,7 +14,7 @@ use super::CodegenError; /// Generate constants from the provided pallet's metadata. /// /// The function creates a new module named `constants` under the pallet's module. -/// ```ignore +/// ```rust,ignore /// pub mod PalletName { /// pub mod constants { /// ... diff --git a/codegen/src/api/events.rs b/codegen/src/api/events.rs index 1d4fdae6dc..0fe92307d9 100644 --- a/codegen/src/api/events.rs +++ b/codegen/src/api/events.rs @@ -13,7 +13,7 @@ use subxt_metadata::PalletMetadata; /// /// The function creates a new module named `events` under the pallet's module. /// -/// ```ignore +/// ```rust,ignore /// pub mod PalletName { /// pub mod events { /// ... @@ -24,7 +24,7 @@ use subxt_metadata::PalletMetadata; /// The function generates the events as rust structs that implement the `subxt::event::StaticEvent` trait /// to uniquely identify the event's identity when creating the extrinsic. /// -/// ```ignore +/// ```rust,ignore /// pub struct EventName { /// pub event_param: type, /// } diff --git a/codegen/src/api/mod.rs b/codegen/src/api/mod.rs index 8f339f95e0..7602f9d363 100644 --- a/codegen/src/api/mod.rs +++ b/codegen/src/api/mod.rs @@ -410,19 +410,24 @@ pub struct StructFromVariant { /// Returns the TokenStream of the type alias module. /// /// E.g a struct like this: -/// ```ignore +/// +/// ```rust,ignore /// pub struct SetMaxCodeSize { /// pub new: ::core::primitive::u32, /// } /// ``` +/// /// will be made into this: -/// ```ignore +/// +/// ```rust,ignore /// pub struct SetMaxCodeSize { /// pub new: set_max_code_size::New, /// } /// ``` +/// /// And the type alias module will look like this: -/// ```ignore +/// +/// ```rust,ignore /// pub mod set_max_code_size { /// use super::runtime_types; /// pub type New = ::core::primitive::u32; diff --git a/codegen/src/lib.rs b/codegen/src/lib.rs index 5c16d67633..b87283d729 100644 --- a/codegen/src/lib.rs +++ b/codegen/src/lib.rs @@ -40,7 +40,7 @@ pub use syn; /// /// Generating an interface using all of the defaults: /// -/// ```rust +/// ```rust,standalone_crate /// use codec::Decode; /// use subxt_codegen::{ Metadata, CodegenBuilder }; /// diff --git a/rpcs/src/client/rpc_client.rs b/rpcs/src/client/rpc_client.rs index faddbca797..f00fb042f5 100644 --- a/rpcs/src/client/rpc_client.rs +++ b/rpcs/src/client/rpc_client.rs @@ -106,7 +106,7 @@ impl std::ops::Deref for RpcClient { /// /// # Example /// -/// ```rust +/// ```rust,standalone_crate /// use subxt_rpcs::client::{ rpc_params, RpcParams }; /// /// // If you provide no params you get `None` back @@ -138,7 +138,7 @@ pub use rpc_params; /// /// # Example /// -/// ```rust +/// ```rust,standalone_crate /// use subxt_rpcs::client::RpcParams; /// /// let mut params = RpcParams::new(); diff --git a/signer/src/ecdsa.rs b/signer/src/ecdsa.rs index 3b052d7fde..fde7ef9828 100644 --- a/signer/src/ecdsa.rs +++ b/signer/src/ecdsa.rs @@ -48,7 +48,7 @@ impl Keypair { /// /// # Example /// - /// ```rust + /// ```rust,standalone_crate /// use subxt_signer::{ SecretUri, ecdsa::Keypair }; /// use std::str::FromStr; /// @@ -84,7 +84,7 @@ impl Keypair { /// /// # Example /// - /// ```rust + /// ```rust,standalone_crate /// use subxt_signer::{ bip39::Mnemonic, ecdsa::Keypair }; /// /// let phrase = "bottom drive obey lake curtain smoke basket hold race lonely fit walk"; @@ -122,7 +122,7 @@ impl Keypair { /// /// # Example /// - /// ```rust + /// ```rust,standalone_crate /// use subxt_signer::{ bip39::Mnemonic, ecdsa::Keypair, DeriveJunction }; /// /// let phrase = "bottom drive obey lake curtain smoke basket hold race lonely fit walk"; @@ -178,7 +178,7 @@ impl Keypair { /// Verify that some signature for a message was created by the owner of the [`PublicKey`]. /// -/// ```rust +/// ```rust,standalone_crate /// use subxt_signer::{ bip39::Mnemonic, ecdsa }; /// /// let keypair = ecdsa::dev::alice(); diff --git a/signer/src/eth.rs b/signer/src/eth.rs index 6aa3b69f30..0a07f4f4c1 100644 --- a/signer/src/eth.rs +++ b/signer/src/eth.rs @@ -46,7 +46,7 @@ impl Keypair { /// /// # Example /// - /// ```rust + /// ```rust,standalone_crate /// use subxt_signer::{ bip39::Mnemonic, eth::{ Keypair, DerivationPath } }; /// /// let phrase = "bottom drive obey lake curtain smoke basket hold race lonely fit walk"; @@ -175,7 +175,7 @@ impl AsRef<[u8; 65]> for Signature { /// Verify that some signature for a message was created by the owner of the [`PublicKey`]. /// -/// ```rust +/// ```rust,standalone_crate /// use subxt_signer::{ bip39::Mnemonic, eth }; /// /// let keypair = eth::dev::alith(); diff --git a/signer/src/sr25519.rs b/signer/src/sr25519.rs index d06edc17eb..d6acef9f3c 100644 --- a/signer/src/sr25519.rs +++ b/signer/src/sr25519.rs @@ -58,7 +58,7 @@ impl Keypair { /// /// # Example /// - /// ```rust + /// ```rust,standalone_crate /// use subxt_signer::{ SecretUri, sr25519::Keypair }; /// use std::str::FromStr; /// @@ -94,7 +94,7 @@ impl Keypair { /// /// # Example /// - /// ```rust + /// ```rust,standalone_crate /// use subxt_signer::{ bip39::Mnemonic, sr25519::Keypair }; /// /// let phrase = "bottom drive obey lake curtain smoke basket hold race lonely fit walk"; @@ -144,7 +144,7 @@ impl Keypair { /// /// # Example /// - /// ```rust + /// ```rust,standalone_crate /// use subxt_signer::{ bip39::Mnemonic, sr25519::Keypair, DeriveJunction }; /// /// let phrase = "bottom drive obey lake curtain smoke basket hold race lonely fit walk"; @@ -186,7 +186,7 @@ impl Keypair { /// Verify that some signature for a message was created by the owner of the [`PublicKey`]. /// -/// ```rust +/// ```rust,standalone_crate /// use subxt_signer::{ bip39::Mnemonic, sr25519 }; /// /// let keypair = sr25519::dev::alice(); diff --git a/subxt/src/backend/mod.rs b/subxt/src/backend/mod.rs index 260cdc9678..16ec794c00 100644 --- a/subxt/src/backend/mod.rs +++ b/subxt/src/backend/mod.rs @@ -29,7 +29,7 @@ pub mod rpc { /// /// # Example /// - /// ```rust,no_run + /// ```rust,no_run,standalone_crate /// use std::time::Duration; /// use futures::StreamExt; /// use subxt::backend::rpc::reconnecting_rpc_client::{RpcClient, ExponentialBackoff}; @@ -541,7 +541,7 @@ mod test { /// - `current_runtime_version` /// - `call` /// The test covers them because they follow the simple pattern of: - /// ```no_run + /// ```rust,no_run,standalone_crate /// async fn THE_THING(&self) -> Result, Error> { /// retry(|| ).await /// } @@ -572,7 +572,7 @@ mod test { /// - `stream_all_block_headers` /// - `stream_best_block_headers` /// The test covers them because they follow the simple pattern of: - /// ```no_run + /// ```rust,no_run,standalone_crate /// async fn stream_the_thing( /// &self, /// ) -> Result>)>, Error> { diff --git a/subxt/src/backend/utils.rs b/subxt/src/backend/utils.rs index 3d04a8a28a..f18a9cf929 100644 --- a/subxt/src/backend/utils.rs +++ b/subxt/src/backend/utils.rs @@ -89,7 +89,7 @@ impl Stream for RetrySubscription { /// /// # Example /// -/// ```no_run +/// ```rust,no_run,standalone_crate /// use subxt::backend::utils::retry; /// /// async fn some_future() -> Result<(), subxt::error::Error> { @@ -149,7 +149,7 @@ where /// /// # Example /// -/// ```no_run +/// ```rust,no_run,standalone_crate /// use subxt::backend::{utils::retry_stream, StreamOf}; /// use futures::future::FutureExt; /// diff --git a/subxt/src/book/setup/codegen.rs b/subxt/src/book/setup/codegen.rs index dd5311ce0d..bd133b2c1b 100644 --- a/subxt/src/book/setup/codegen.rs +++ b/subxt/src/book/setup/codegen.rs @@ -13,7 +13,7 @@ //! The most common way to generate the interface is to use the [`#[subxt]`](crate::subxt) macro. //! Using this macro looks something like: //! -//! ```rust,no_run +//! ```rust,no_run,standalone_crate //! #[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_tiny.scale")] //! pub mod polkadot {} //! ``` diff --git a/subxt/src/book/setup/config.rs b/subxt/src/book/setup/config.rs index c2af70530a..fad04c153a 100644 --- a/subxt/src/book/setup/config.rs +++ b/subxt/src/book/setup/config.rs @@ -96,7 +96,7 @@ //! For statemint, the transaction extensions look like //! [this](https://github.com/paritytech/cumulus/blob/d4bb2215bb28ee05159c4c7df1b3435177b5bf4e/parachains/runtimes/assets/asset-hub-polkadot/src/lib.rs#L786): //! -//! ```rs +//! ```rust,ignore //! pub type SignedExtra = ( //! frame_system::CheckNonZeroSender, //! frame_system::CheckSpecVersion, diff --git a/subxt/src/book/usage/constants.rs b/subxt/src/book/usage/constants.rs index e33738484e..4b08f768bf 100644 --- a/subxt/src/book/usage/constants.rs +++ b/subxt/src/book/usage/constants.rs @@ -15,7 +15,7 @@ //! //! We can use the statically generated interface to build constant queries: //! -//! ```rust,no_run +//! ```rust,no_run,standalone_crate //! #[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_full.scale")] //! pub mod polkadot {} //! @@ -24,7 +24,7 @@ //! //! Alternately, we can dynamically construct a constant query: //! -//! ```rust,no_run +//! ```rust,no_run,standalone_crate //! use subxt::dynamic::Value; //! //! let storage_query = subxt::dynamic::constant("System", "BlockLength"); diff --git a/subxt/src/book/usage/events.rs b/subxt/src/book/usage/events.rs index 0c78f9e8f8..e851f38b95 100644 --- a/subxt/src/book/usage/events.rs +++ b/subxt/src/book/usage/events.rs @@ -18,7 +18,7 @@ //! by that transaction being executed. We can also access _all_ of the events produced in a single block using one //! of these two interfaces: //! -//! ```rust,no_run +//! ```rust,no_run,standalone_crate //! # #[tokio::main] //! # async fn main() -> Result<(), Box> { //! use subxt::client::OnlineClient; diff --git a/subxt/src/book/usage/runtime_apis.rs b/subxt/src/book/usage/runtime_apis.rs index fb74b95ec0..7485a8d2a8 100644 --- a/subxt/src/book/usage/runtime_apis.rs +++ b/subxt/src/book/usage/runtime_apis.rs @@ -21,7 +21,7 @@ //! //! We can use the statically generated interface to build runtime calls: //! -//! ```rust,no_run +//! ```rust,no_run,standalone_crate //! #[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")] //! pub mod polkadot {} //! diff --git a/subxt/src/book/usage/storage.rs b/subxt/src/book/usage/storage.rs index a1aa83a40b..9fe461f19a 100644 --- a/subxt/src/book/usage/storage.rs +++ b/subxt/src/book/usage/storage.rs @@ -15,7 +15,7 @@ //! //! We can use the statically generated interface to build storage queries: //! -//! ```rust,no_run +//! ```rust,no_run,standalone_crate //! use subxt_signer::sr25519::dev; //! //! #[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")] @@ -28,7 +28,7 @@ //! Alternately, we can dynamically construct a storage query. This will not be type checked or //! validated until it's submitted: //! -//! ```rust,no_run +//! ```rust,no_run,standalone_crate //! use subxt_signer::sr25519::dev; //! use subxt::dynamic::Value; //! @@ -42,7 +42,7 @@ //! the map of account information). To do this, suffix `_iter` onto the query constructor (this //! will only be available on static constructors when iteration is actually possible): //! -//! ```rust,no_run +//! ```rust,no_run,standalone_crate //! #[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")] //! pub mod polkadot {} //! diff --git a/subxt/src/book/usage/transactions.rs b/subxt/src/book/usage/transactions.rs index 2cfe818682..c427acd5de 100644 --- a/subxt/src/book/usage/transactions.rs +++ b/subxt/src/book/usage/transactions.rs @@ -25,7 +25,7 @@ //! //! We can use the statically generated interface to build transaction payloads: //! -//! ```rust,no_run +//! ```rust,no_run,standalone_crate //! #[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")] //! pub mod polkadot {} //! @@ -41,7 +41,7 @@ //! Alternately, we can dynamically construct a transaction payload. This will not be type checked or //! validated until it's submitted: //! -//! ```rust,no_run +//! ```rust,no_run,standalone_crate //! use subxt::dynamic::Value; //! //! let tx_payload = subxt::dynamic::tx("System", "remark", vec![ @@ -79,7 +79,7 @@ //! //! Let's go through how to create a signer using the `subxt_signer` crate: //! -//! ```rust +//! ```rust,standalone_crate //! use subxt::config::PolkadotConfig; //! use std::str::FromStr; //! @@ -97,7 +97,7 @@ //! //! After initializing the signer, let's also go through how to create a transaction and sign it: //! -//! ```rust,no_run +//! ```rust,no_run,standalone_crate //! # #[tokio::main] //! # async fn main() -> Result<(), Box> { //! use subxt::client::OnlineClient; diff --git a/subxt/src/client/online_client.rs b/subxt/src/client/online_client.rs index e5fb64dc83..849b006b69 100644 --- a/subxt/src/client/online_client.rs +++ b/subxt/src/client/online_client.rs @@ -214,7 +214,7 @@ impl OnlineClient { /// /// # Example /// - /// ```no_run + /// ```rust,no_run,standalone_crate /// # #[tokio::main] /// # async fn main() { /// use subxt::{ OnlineClient, PolkadotConfig }; diff --git a/subxt/src/lib.rs b/subxt/src/lib.rs index 972e0969d6..b6b872952b 100644 --- a/subxt/src/lib.rs +++ b/subxt/src/lib.rs @@ -144,7 +144,7 @@ pub mod ext { /// /// Annotate a Rust module with the `subxt` attribute referencing a metadata file like so: /// -/// ```rust,no_run +/// ```rust,no_run,standalone_crate /// #[subxt::subxt( /// runtime_metadata_path = "../artifacts/polkadot_metadata_full.scale", /// )] @@ -157,7 +157,7 @@ pub mod ext { /// /// Annotate a Rust module with the `subxt` attribute referencing some runtime WASM like so: /// -/// ```rust,no_run +/// ```rust,ignore /// #[subxt::subxt( /// runtime_path = "../artifacts/westend_runtime.wasm", /// )] @@ -191,7 +191,7 @@ pub mod ext { /// /// Use this attribute to specify a custom path to the `subxt_core` crate: /// -/// ```rust +/// ```rust,standalone_crate /// # pub extern crate subxt_core; /// # pub mod path { pub mod to { pub use subxt_core; } } /// # fn main() {} @@ -210,7 +210,7 @@ pub mod ext { /// This attribute replaces any reference to the generated type at the path given by `path` with a /// reference to the path given by `with`. /// -/// ```rust +/// ```rust,standalone_crate /// #[subxt::subxt( /// runtime_metadata_path = "../artifacts/polkadot_metadata_full.scale", /// substitute_type(path = "sp_arithmetic::per_things::Perbill", with = "crate::Foo") @@ -248,7 +248,7 @@ pub mod ext { /// If the type you're substituting contains generic parameters, you can "pattern match" on those, and /// make use of them in the substituted type, like so: /// -/// ```rust,no_run +/// ```rust,no_run,standalone_crate /// #[subxt::subxt( /// runtime_metadata_path = "../artifacts/polkadot_metadata_full.scale", /// substitute_type( @@ -268,7 +268,7 @@ pub mod ext { /// By default, all generated types derive a small set of traits. This attribute allows you to derive additional /// traits on all generated types: /// -/// ```rust,no_run +/// ```rust,no_run,standalone_crate /// #[subxt::subxt( /// runtime_metadata_path = "../artifacts/polkadot_metadata_full.scale", /// derive_for_all_types = "Eq, PartialEq" @@ -284,7 +284,7 @@ pub mod ext { /// Unlike the above, which derives some trait on every generated type, this attribute allows you to derive traits only /// for specific types. Note that any types which are used inside the specified type may also need to derive the same traits. /// -/// ```rust,no_run +/// ```rust,no_run,standalone_crate /// #[subxt::subxt( /// runtime_metadata_path = "../artifacts/polkadot_metadata_full.scale", /// derive_for_all_types = "Eq, PartialEq", @@ -299,7 +299,7 @@ pub mod ext { /// By default, documentation is not generated via the macro, since IDEs do not typically make use of it. This attribute /// forces documentation to be generated, too. /// -/// ```rust,no_run +/// ```rust,no_run,standalone_crate /// #[subxt::subxt( /// runtime_metadata_path = "../artifacts/polkadot_metadata_full.scale", /// generate_docs @@ -312,7 +312,7 @@ pub mod ext { /// By default, the macro will generate various interfaces to make using Subxt simpler in addition with any types that need /// generating to make this possible. This attribute makes the codegen only generate the types and not the Subxt interface. /// -/// ```rust,no_run +/// ```rust,no_run,standalone_crate /// #[subxt::subxt( /// runtime_metadata_path = "../artifacts/polkadot_metadata_full.scale", /// runtime_types_only @@ -325,7 +325,7 @@ pub mod ext { /// By default, the macro will add all derives necessary for the generated code to play nicely with Subxt. Adding this attribute /// removes all default derives. /// -/// ```rust,no_run +/// ```rust,no_run,standalone_crate /// #[subxt::subxt( /// runtime_metadata_path = "../artifacts/polkadot_metadata_full.scale", /// runtime_types_only, diff --git a/subxt/src/storage/storage_type.rs b/subxt/src/storage/storage_type.rs index 3a507de374..7025584e4f 100644 --- a/subxt/src/storage/storage_type.rs +++ b/subxt/src/storage/storage_type.rs @@ -84,7 +84,7 @@ where /// /// # Example /// - /// ```no_run + /// ```rust,no_run,standalone_crate /// use subxt::{ PolkadotConfig, OnlineClient }; /// /// #[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_full.scale")] @@ -161,7 +161,7 @@ where /// Returns an iterator of key value pairs. /// - /// ```no_run + /// ```rust,no_run,standalone_crate /// use subxt::{ PolkadotConfig, OnlineClient }; /// /// #[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_full.scale")] diff --git a/testing/integration-tests/src/full_client/codegen/mod.rs b/testing/integration-tests/src/full_client/codegen/mod.rs index 6c606a317e..7c13ae97e7 100644 --- a/testing/integration-tests/src/full_client/codegen/mod.rs +++ b/testing/integration-tests/src/full_client/codegen/mod.rs @@ -7,7 +7,7 @@ /// /// Generate by running this at the root of the repository: /// -/// ``` +/// ```text /// cargo run --bin subxt -- codegen --file artifacts/polkadot_metadata_full.scale | rustfmt > testing/integration-tests/src/full_client/codegen/polkadot.rs /// ``` #[rustfmt::skip]