Files
pezkuwi-subxt/codegen/src/lib.rs
T
Andrew Jones b0004ea79f Refactor type generation, remove code duplication (#352)
* codegen: fix compact unnamed fields

* Fmt

* codegen: move derives and struct_def to types

* codegen: rename struct_def to composite_def.r

* WIP: deduplicate struct def code

* Fmt

* WIP refactoring composite type codegen duplication

* Fmt

* Fix TokenStream import

* Fix field_tokens ty_path parse error

* Fix call struct generation

* Refactor ty_path()

* Optional derives and move CompactAs derive to composite_def

* Fmt

* Introduce CompositeDefFieldType

* Restore default codec derives

* Extract TypeDefParameters and TypeDefGen construction

* Fmt

* Reset codegen to master

* Introduce CompositeDefFields

* Introduce CompositeDefFields

* Fix up errors

* Fix Box field types

* Fmt

* Fix compact attribute

* Handle no fields case

* Handle no fields with trailing semi

* Fix compact field detection

* Fix generic phantom marker

* Fmt

* Fix generic type parm fields

* Clippy

* Fix up boxed call fields

* Fmt

* Add comments to composite_def.rs

* Fix license headers

* Restore Debug derive in tests

* Fix empty struct codegen test

* Use BTreeSet for type params for ordering

* code review: fix comment

* code review: refactor CompositeDefFields as enum

* Fix empty named fields

* Fix generation of call variant enum structs

* Expand field_tokens into separate methods for struct and enum variants

* Add TypeDefParameters docs

* Fix doc link

* Clippy redundant return
2022-01-26 09:18:13 +00:00

30 lines
943 B
Rust

// Copyright 2019-2022 Parity Technologies (UK) Ltd.
// This file is part of subxt.
//
// subxt is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// subxt is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with subxt. If not, see <http://www.gnu.org/licenses/>.
//! Library to generate an API for a Substrate runtime from its metadata.
mod api;
mod ir;
mod types;
pub use self::{
api::{
generate_runtime_api,
RuntimeGenerator,
},
types::GeneratedTypeDerives,
};