From ba7af66ca834fbaa9e708029d950caf4b0729ba8 Mon Sep 17 00:00:00 2001
From: vms <michail.vms@gmail.com>
Date: Thu, 22 Apr 2021 17:57:47 +0300
Subject: [PATCH] renaming

---
 crates/main/src/lib.rs                        |  2 +-
 crates/wit/src/ast_types.rs                   | 16 +++----
 crates/wit/src/export_ast_types.rs            | 48 +++++++++----------
 crates/wit/src/parse_macro_input/item_fn.rs   |  4 +-
 .../src/parse_macro_input/item_foreign_mod.rs | 10 ++--
 .../wit/src/parse_macro_input/item_record.rs  |  2 +-
 .../token_stream_generator/fn_generator.rs    |  2 +-
 .../foreign_mod_generator.rs                  |  6 +--
 .../record_generator.rs                       |  8 ++--
 .../record_generator/record_deserializer.rs   |  2 +-
 .../record_generator/record_serializer.rs     |  4 +-
 11 files changed, 52 insertions(+), 52 deletions(-)

diff --git a/crates/main/src/lib.rs b/crates/main/src/lib.rs
index 31f4a01..5cc8216 100644
--- a/crates/main/src/lib.rs
+++ b/crates/main/src/lib.rs
@@ -66,7 +66,7 @@ macro_rules! debug_log {
             let level = log::Level::Info as i32;
             let target = 0i32;
             let msg = $msg_generator;
-            logger::log_utf8_string(level, target, msg.as_ptr() as i32, msg.len() as i32);
+            crate::logger::log_utf8_string(level, target, msg.as_ptr() as i32, msg.len() as i32);
         }
     };
 }
diff --git a/crates/wit/src/ast_types.rs b/crates/wit/src/ast_types.rs
index b5657ae..f3d39ea 100644
--- a/crates/wit/src/ast_types.rs
+++ b/crates/wit/src/ast_types.rs
@@ -33,7 +33,7 @@ pub(crate) struct AstFnSignature {
 }
 
 #[derive(Clone)]
-pub(crate) struct AstRecordItem {
+pub(crate) struct AstRecord {
     pub name: String,
     pub fields: AstRecordFields,
     pub original: syn::ItemStruct,
@@ -60,29 +60,29 @@ pub(crate) struct AstRecordField {
 }
 
 #[derive(Clone)]
-pub(crate) struct AstExternFnItem {
+pub(crate) struct AstExternFn {
     pub link_name: Option<String>,
     // only imports are possible here
     pub signature: AstFnSignature,
 }
 
 #[derive(Clone)]
-pub(crate) struct AstExternModItem {
+pub(crate) struct AstExternMod {
     pub namespace: String,
     // only imports are possible here
-    pub imports: Vec<AstExternFnItem>,
+    pub imports: Vec<AstExternFn>,
     pub original: syn::ItemForeignMod,
 }
 
 #[derive(Clone)]
-pub(crate) struct AstFnItem {
+pub(crate) struct AstFn {
     pub signature: AstFnSignature,
     pub original: syn::ItemFn,
 }
 
 #[derive(Clone)]
 pub(crate) enum FCEAst {
-    Function(AstFnItem),
-    ExternMod(AstExternModItem),
-    Record(AstRecordItem),
+    Function(AstFn),
+    ExternMod(AstExternMod),
+    Record(AstRecord),
 }
diff --git a/crates/wit/src/export_ast_types.rs b/crates/wit/src/export_ast_types.rs
index 422fa02..b164899 100644
--- a/crates/wit/src/export_ast_types.rs
+++ b/crates/wit/src/export_ast_types.rs
@@ -33,7 +33,7 @@ pub struct FnSignature {
 }
 
 #[derive(Clone, Serialize, Deserialize)]
-pub struct RecordItem {
+pub struct RecordType {
     pub name: String,
     pub fields: RecordFields,
 }
@@ -55,68 +55,68 @@ pub struct RecordField {
 }
 
 #[derive(Clone, Serialize, Deserialize)]
-pub struct ExternFnItem {
+pub struct ExternFnType {
     pub link_name: Option<String>,
     // only imports are possible here
     pub signature: FnSignature,
 }
 
 #[derive(Clone, Serialize, Deserialize)]
-pub struct ExternModItem {
+pub struct ExternModType {
     pub namespace: String,
     // only imports are possible here
-    pub imports: Vec<ExternFnItem>,
+    pub imports: Vec<ExternFnType>,
 }
 
 #[derive(Clone, Serialize, Deserialize)]
-pub struct FnItem {
+pub struct FnType {
     pub signature: FnSignature,
 }
 
 #[derive(Clone, Serialize, Deserialize)]
 #[serde(tag = "ast_type")]
 pub enum SDKAst {
-    Function(FnItem),
-    ExternMod(ExternModItem),
-    Record(RecordItem),
+    Function(FnType),
+    ExternMod(ExternModType),
+    Record(RecordType),
 }
 
 use crate::ast_types::{
-    AstFnItem, AstFnSignature, AstFnArgument, AstExternModItem, AstExternFnItem, AstRecordField,
-    AstRecordItem, AstRecordFields,
+    AstFn, AstFnSignature, AstFnArgument, AstExternMod, AstExternFn, AstRecordField, AstRecord,
+    AstRecordFields,
 };
 
-impl From<AstFnItem> for SDKAst {
-    fn from(ast_fn_item: AstFnItem) -> Self {
+impl From<AstFn> for SDKAst {
+    fn from(ast_fn_item: AstFn) -> Self {
         let fn_item = ast_fn_item.into();
         Self::Function(fn_item)
     }
 }
 
-impl From<AstExternModItem> for SDKAst {
-    fn from(ast_extern_mod: AstExternModItem) -> Self {
+impl From<AstExternMod> for SDKAst {
+    fn from(ast_extern_mod: AstExternMod) -> Self {
         let extern_mod = ast_extern_mod.into();
         Self::ExternMod(extern_mod)
     }
 }
 
-impl From<AstRecordItem> for SDKAst {
-    fn from(ast_record_item: AstRecordItem) -> Self {
+impl From<AstRecord> for SDKAst {
+    fn from(ast_record_item: AstRecord) -> Self {
         let record_item = ast_record_item.into();
         Self::Record(record_item)
     }
 }
 
-impl From<AstFnItem> for FnItem {
-    fn from(ast_fn_item: AstFnItem) -> Self {
+impl From<AstFn> for FnType {
+    fn from(ast_fn_item: AstFn) -> Self {
         let signature = ast_fn_item.signature.into();
 
         Self { signature }
     }
 }
 
-impl From<AstExternModItem> for ExternModItem {
-    fn from(ast_extern_mod: AstExternModItem) -> Self {
+impl From<AstExternMod> for ExternModType {
+    fn from(ast_extern_mod: AstExternMod) -> Self {
         let imports = ast_extern_mod.imports.into_iter().map(Into::into).collect();
 
         Self {
@@ -126,8 +126,8 @@ impl From<AstExternModItem> for ExternModItem {
     }
 }
 
-impl From<AstRecordItem> for RecordItem {
-    fn from(ast_record_item: AstRecordItem) -> Self {
+impl From<AstRecord> for RecordType {
+    fn from(ast_record_item: AstRecord) -> Self {
         Self {
             name: ast_record_item.name,
             fields: ast_record_item.fields.into(),
@@ -177,8 +177,8 @@ impl From<AstFnArgument> for FnArgument {
     }
 }
 
-impl From<AstExternFnItem> for ExternFnItem {
-    fn from(ast_extern_item: AstExternFnItem) -> Self {
+impl From<AstExternFn> for ExternFnType {
+    fn from(ast_extern_item: AstExternFn) -> Self {
         Self {
             link_name: ast_extern_item.link_name,
             signature: ast_extern_item.signature.into(),
diff --git a/crates/wit/src/parse_macro_input/item_fn.rs b/crates/wit/src/parse_macro_input/item_fn.rs
index eb93fe0..14df958 100644
--- a/crates/wit/src/parse_macro_input/item_fn.rs
+++ b/crates/wit/src/parse_macro_input/item_fn.rs
@@ -18,7 +18,7 @@ use super::ParseMacroInput;
 use crate::ast_types;
 use crate::ParsedType;
 use crate::ast_types::FCEAst;
-use crate::ast_types::AstFnItem;
+use crate::ast_types::AstFn;
 use crate::ast_types::AstFnArgument;
 use crate::syn_error;
 
@@ -38,7 +38,7 @@ impl ParseMacroInput for syn::ItemFn {
         check_args(parsed_args)?;
         check_output_type(&signature.output_type, self.sig.output.span())?;
 
-        let ast_fn = FCEAst::Function(AstFnItem {
+        let ast_fn = FCEAst::Function(AstFn {
             signature,
             original: self,
         });
diff --git a/crates/wit/src/parse_macro_input/item_foreign_mod.rs b/crates/wit/src/parse_macro_input/item_foreign_mod.rs
index 9fe07e6..72d4f14 100644
--- a/crates/wit/src/parse_macro_input/item_foreign_mod.rs
+++ b/crates/wit/src/parse_macro_input/item_foreign_mod.rs
@@ -36,7 +36,7 @@ impl ParseMacroInput for syn::ItemForeignMod {
         let imports = extract_import_functions(&self)?;
         check_imports(imports.iter().zip(self.items.iter().map(|i| i.span())))?;
 
-        let extern_mod_item = ast_types::AstExternModItem {
+        let extern_mod_item = ast_types::AstExternMod {
             namespace,
             imports,
             original: self,
@@ -99,7 +99,7 @@ fn try_extract_namespace(
 
 fn extract_import_functions(
     foreign_mod: &syn::ItemForeignMod,
-) -> Result<Vec<ast_types::AstExternFnItem>> {
+) -> Result<Vec<ast_types::AstExternFn>> {
     foreign_mod
         .items
         .iter()
@@ -111,7 +111,7 @@ fn extract_import_functions(
 /// This function checks whether these imports contains inner references. In this case glue
 /// code couldn't be generated.
 fn check_imports<'i>(
-    extern_fns: impl ExactSizeIterator<Item = (&'i ast_types::AstExternFnItem, proc_macro2::Span)>,
+    extern_fns: impl ExactSizeIterator<Item = (&'i ast_types::AstExternFn, proc_macro2::Span)>,
 ) -> Result<()> {
     use super::utils::contain_inner_ref;
 
@@ -129,7 +129,7 @@ fn check_imports<'i>(
     Ok(())
 }
 
-fn parse_raw_foreign_item(raw_item: syn::ForeignItem) -> Result<ast_types::AstExternFnItem> {
+fn parse_raw_foreign_item(raw_item: syn::ForeignItem) -> Result<ast_types::AstExternFn> {
     let function_item = match raw_item {
         syn::ForeignItem::Fn(function_item) => function_item,
         _ => {
@@ -158,7 +158,7 @@ fn parse_raw_foreign_item(raw_item: syn::ForeignItem) -> Result<ast_types::AstEx
     };
 
     let signature = super::item_fn::try_to_ast_signature(function_item.sig, function_item.vis)?;
-    let ast_extern_fn_item = ast_types::AstExternFnItem {
+    let ast_extern_fn_item = ast_types::AstExternFn {
         link_name,
         signature,
     };
diff --git a/crates/wit/src/parse_macro_input/item_record.rs b/crates/wit/src/parse_macro_input/item_record.rs
index 5806547..51c0ce3 100644
--- a/crates/wit/src/parse_macro_input/item_record.rs
+++ b/crates/wit/src/parse_macro_input/item_record.rs
@@ -38,7 +38,7 @@ impl ParseMacroInput for syn::ItemStruct {
         let fields = AstRecordFields::Named(fields);
 
         let name = self.ident.to_string();
-        let ast_record_item = ast_types::AstRecordItem {
+        let ast_record_item = ast_types::AstRecord {
             name,
             fields,
             original: self,
diff --git a/crates/wit/src/token_stream_generator/fn_generator.rs b/crates/wit/src/token_stream_generator/fn_generator.rs
index 4377cbe..e810580 100644
--- a/crates/wit/src/token_stream_generator/fn_generator.rs
+++ b/crates/wit/src/token_stream_generator/fn_generator.rs
@@ -25,7 +25,7 @@ use crate::new_ident;
 
 use proc_macro2::TokenStream;
 
-impl quote::ToTokens for ast_types::AstFnItem {
+impl quote::ToTokens for ast_types::AstFn {
     fn to_tokens(&self, tokens: &mut TokenStream) {
         crate::prepare_global_data!(
             Function,
diff --git a/crates/wit/src/token_stream_generator/foreign_mod_generator.rs b/crates/wit/src/token_stream_generator/foreign_mod_generator.rs
index 76afdc0..501f760 100644
--- a/crates/wit/src/token_stream_generator/foreign_mod_generator.rs
+++ b/crates/wit/src/token_stream_generator/foreign_mod_generator.rs
@@ -21,7 +21,7 @@ use crate::parsed_type::*;
 use proc_macro2::TokenStream;
 use quote::quote;
 
-impl quote::ToTokens for ast_types::AstExternModItem {
+impl quote::ToTokens for ast_types::AstExternMod {
     fn to_tokens(&self, tokens: &mut TokenStream) {
         crate::prepare_global_data!(
             ExternMod,
@@ -61,7 +61,7 @@ impl quote::ToTokens for ast_types::AstExternModItem {
     }
 }
 
-fn generate_extern_section_items(extern_item: &ast_types::AstExternModItem) -> Vec<TokenStream> {
+fn generate_extern_section_items(extern_item: &ast_types::AstExternMod) -> Vec<TokenStream> {
     let mut section_items = Vec::with_capacity(extern_item.imports.len());
 
     for import in &extern_item.imports {
@@ -90,7 +90,7 @@ fn generate_import_name(import_name: &str) -> syn::Ident {
     crate::new_ident!(format!("{}_{}", super::GENERATED_WRAPPER_FUNC_PREFIX, import_name))
 }
 
-fn generate_wrapper_functions(extern_item: &ast_types::AstExternModItem) -> TokenStream {
+fn generate_wrapper_functions(extern_item: &ast_types::AstExternMod) -> TokenStream {
     let mut token_stream = TokenStream::new();
 
     for import in &extern_item.imports {
diff --git a/crates/wit/src/token_stream_generator/record_generator.rs b/crates/wit/src/token_stream_generator/record_generator.rs
index 1cdfe08..be43b05 100644
--- a/crates/wit/src/token_stream_generator/record_generator.rs
+++ b/crates/wit/src/token_stream_generator/record_generator.rs
@@ -23,10 +23,10 @@ use record_deserializer::*;
 use record_serializer::*;
 
 use crate::new_ident;
-use crate::ast_types::AstRecordItem;
+use crate::ast_types::AstRecord;
 use crate::ast_types::AstRecordFields;
 
-impl quote::ToTokens for AstRecordItem {
+impl quote::ToTokens for AstRecord {
     fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) {
         let original = &self.original;
         crate::prepare_global_data!(
@@ -68,7 +68,7 @@ impl quote::ToTokens for AstRecordItem {
     }
 }
 
-fn generate_serializer_fn(record: &AstRecordItem) -> proc_macro2::TokenStream {
+fn generate_serializer_fn(record: &AstRecord) -> proc_macro2::TokenStream {
     let serializer = record.generate_serializer();
     let fields_count = match &record.fields {
         AstRecordFields::Named(fields) => fields.len(),
@@ -91,7 +91,7 @@ fn generate_serializer_fn(record: &AstRecordItem) -> proc_macro2::TokenStream {
     }
 }
 
-fn generate_deserializer_fn(record: &AstRecordItem) -> proc_macro2::TokenStream {
+fn generate_deserializer_fn(record: &AstRecord) -> proc_macro2::TokenStream {
     let RecordDerDescriptor {
         fields_der,
         record_ctor,
diff --git a/crates/wit/src/token_stream_generator/record_generator/record_deserializer.rs b/crates/wit/src/token_stream_generator/record_generator/record_deserializer.rs
index fd98fc3..d2ecfe0 100644
--- a/crates/wit/src/token_stream_generator/record_generator/record_deserializer.rs
+++ b/crates/wit/src/token_stream_generator/record_generator/record_deserializer.rs
@@ -32,7 +32,7 @@ pub(super) trait RecordDerGlueCodeGenerator {
     fn generate_der(&self) -> RecordDerDescriptor;
 }
 
-impl RecordDerGlueCodeGenerator for AstRecordItem {
+impl RecordDerGlueCodeGenerator for AstRecord {
     fn generate_der(&self) -> RecordDerDescriptor {
         match &self.fields {
             AstRecordFields::Named(fields) => record_der_from_named(fields),
diff --git a/crates/wit/src/token_stream_generator/record_generator/record_serializer.rs b/crates/wit/src/token_stream_generator/record_generator/record_serializer.rs
index bee119a..f3de573 100644
--- a/crates/wit/src/token_stream_generator/record_generator/record_serializer.rs
+++ b/crates/wit/src/token_stream_generator/record_generator/record_serializer.rs
@@ -16,7 +16,7 @@
 
 use crate::new_ident;
 use crate::parsed_type::ParsedType;
-use crate::ast_types::AstRecordItem;
+use crate::ast_types::AstRecord;
 use crate::ast_types::AstRecordField;
 use crate::ast_types::AstRecordFields;
 
@@ -27,7 +27,7 @@ pub(super) trait RecordSerGlueCodeGenerator {
     fn generate_serializer(&self) -> proc_macro2::TokenStream;
 }
 
-impl RecordSerGlueCodeGenerator for AstRecordItem {
+impl RecordSerGlueCodeGenerator for AstRecord {
     fn generate_serializer(&self) -> proc_macro2::TokenStream {
         let mut serializer = proc_macro2::TokenStream::new();
         let fields = match &self.fields {