mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 05:17:58 +00:00
Allow specifying the subxt crate path for generated code (#664)
* Allow specifying the `subxt` crate path for generated code * Make `clippy` happy * Add documentation * Improve optics * Remove custom crate path test * Implement comments * Update comment * Make `crate_path` property instead of argument * Remove unnecessary derives * Remove `Default` impls in favor of explicit constructors * Remove unnecessary `into` * Update codegen/src/types/mod.rs Co-authored-by: Andrew Jones <ascjones@gmail.com> Co-authored-by: Andrew Jones <ascjones@gmail.com>
This commit is contained in:
+4
-3
@@ -21,7 +21,7 @@
|
||||
//! use std::fs;
|
||||
//! use codec::Decode;
|
||||
//! use frame_metadata::RuntimeMetadataPrefixed;
|
||||
//! use subxt_codegen::DerivesRegistry;
|
||||
//! use subxt_codegen::{CratePath, DerivesRegistry};
|
||||
//!
|
||||
//! let encoded = fs::read("../artifacts/polkadot_metadata.scale").unwrap();
|
||||
//!
|
||||
@@ -32,10 +32,10 @@
|
||||
//! pub mod api {}
|
||||
//! );
|
||||
//! // Default module derivatives.
|
||||
//! let mut derives = DerivesRegistry::default();
|
||||
//! let mut derives = DerivesRegistry::new(&CratePath::default());
|
||||
//! // Generate the Runtime API.
|
||||
//! let generator = subxt_codegen::RuntimeGenerator::new(metadata);
|
||||
//! let runtime_api = generator.generate_runtime(item_mod, derives);
|
||||
//! let runtime_api = generator.generate_runtime(item_mod, derives, CratePath::default());
|
||||
//! println!("{}", runtime_api);
|
||||
//! ```
|
||||
|
||||
@@ -51,6 +51,7 @@ pub use self::{
|
||||
RuntimeGenerator,
|
||||
},
|
||||
types::{
|
||||
CratePath,
|
||||
Derives,
|
||||
DerivesRegistry,
|
||||
Module,
|
||||
|
||||
Reference in New Issue
Block a user