mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 00:37:57 +00:00
977f2a3333
* feat!: Allow for remapping type parameters in type substitutions * chore: cargo fmt * chore: cargo clippy * chore: Remove some old code * a little tidy * address comment nit Co-authored-by: James Wilson <james@jsdw.me>
41 lines
984 B
Rust
41 lines
984 B
Rust
// Copyright 2019-2022 Parity Technologies (UK) Ltd.
|
|
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
|
|
// see LICENSE for license details.
|
|
|
|
use proc_macro_error::abort;
|
|
use syn::token;
|
|
|
|
#[derive(Debug, PartialEq, Eq)]
|
|
pub struct ItemMod {
|
|
vis: syn::Visibility,
|
|
mod_token: token::Mod,
|
|
pub ident: syn::Ident,
|
|
brace: token::Brace,
|
|
items: Vec<syn::Item>,
|
|
}
|
|
|
|
impl From<syn::ItemMod> for ItemMod {
|
|
fn from(module: syn::ItemMod) -> Self {
|
|
let (brace, items) = match module.content {
|
|
Some((brace, items)) => (brace, items),
|
|
None => {
|
|
abort!(module, "out-of-line subxt modules are not supported",)
|
|
}
|
|
};
|
|
|
|
Self {
|
|
vis: module.vis,
|
|
mod_token: module.mod_token,
|
|
ident: module.ident,
|
|
brace,
|
|
items,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl ItemMod {
|
|
pub fn rust_items(&self) -> impl Iterator<Item = &syn::Item> {
|
|
self.items.iter()
|
|
}
|
|
}
|