mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-24 02:01:06 +00:00
Add custom derives for specific generated types (#520)
* WIP implement custom derives per type * WIP wiring up specific type derives * Fmt * Rename GeneratedTypeDerives to Derives * Fmt * Fix errors * Fix test runtime * Make derives appear in alphabetic order * Clippy * Add derive_for_type attribute to example * Add docs to example * Rename GeneratedTypeDerive * Rename ty to type in attribute * Update darling * Update codegen/src/types/derives.rs Co-authored-by: Alexandru Vasile <60601340+lexnv@users.noreply.github.com> * Update codegen/src/types/mod.rs Co-authored-by: Alexandru Vasile <60601340+lexnv@users.noreply.github.com> * Update codegen/src/types/mod.rs Co-authored-by: Alexandru Vasile <60601340+lexnv@users.noreply.github.com> * review: update method name * Add unit tests for combined derives * Remove out of date docs * Add macro usage docs Co-authored-by: Alexandru Vasile <60601340+lexnv@users.noreply.github.com>
This commit is contained in:
+3
-3
@@ -43,7 +43,7 @@ use std::{
|
||||
path::PathBuf,
|
||||
};
|
||||
use structopt::StructOpt;
|
||||
use subxt_codegen::GeneratedTypeDerives;
|
||||
use subxt_codegen::DerivesRegistry;
|
||||
use subxt_metadata::{
|
||||
get_metadata_hash,
|
||||
get_pallet_hash,
|
||||
@@ -288,8 +288,8 @@ fn codegen<I: Input>(
|
||||
.iter()
|
||||
.map(|raw| syn::parse_str(raw))
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
let mut derives = GeneratedTypeDerives::default();
|
||||
derives.append(p.into_iter());
|
||||
let mut derives = DerivesRegistry::default();
|
||||
derives.extend_for_all(p.into_iter());
|
||||
|
||||
let runtime_api = generator.generate_runtime(item_mod, derives);
|
||||
println!("{}", runtime_api);
|
||||
|
||||
Reference in New Issue
Block a user