mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-23 03:47:59 +00:00
Generate only runtime types (#845)
* Typos * Add new macro parameter. Refactor. * Code generation * Inline `runtime_types` module * Documentation * Can't inline so easily * Example * Remove leftover * Improve clarity of the example
This commit is contained in:
committed by
GitHub
parent
29a4a48dcc
commit
c9527abaa8
@@ -45,6 +45,9 @@ pub struct Opts {
|
||||
/// Defaults to `false` (documentation is generated).
|
||||
#[clap(long, action)]
|
||||
no_docs: bool,
|
||||
/// Whether to limit code generation to only runtime types.
|
||||
#[clap(long)]
|
||||
runtime_types_only: bool,
|
||||
}
|
||||
|
||||
fn derive_for_type_parser(src: &str) -> Result<(String, String), String> {
|
||||
@@ -80,6 +83,7 @@ pub async fn run(opts: Opts) -> color_eyre::Result<()> {
|
||||
opts.derives_for_type,
|
||||
opts.crate_path,
|
||||
opts.no_docs,
|
||||
opts.runtime_types_only,
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
@@ -90,6 +94,7 @@ fn codegen(
|
||||
derives_for_type: Vec<(String, String)>,
|
||||
crate_path: Option<String>,
|
||||
no_docs: bool,
|
||||
runtime_types_only: bool,
|
||||
) -> color_eyre::Result<()> {
|
||||
let item_mod = syn::parse_quote!(
|
||||
pub mod api {}
|
||||
@@ -120,6 +125,7 @@ fn codegen(
|
||||
type_substitutes,
|
||||
crate_path,
|
||||
should_gen_docs,
|
||||
runtime_types_only,
|
||||
);
|
||||
match runtime_api {
|
||||
Ok(runtime_api) => println!("{runtime_api}"),
|
||||
|
||||
Reference in New Issue
Block a user