From de5f3ee8aa412c4ba3a245d41cee64727cc272ed Mon Sep 17 00:00:00 2001 From: dark-flames Date: Sun, 18 Aug 2024 16:33:17 +0000 Subject: [PATCH] chore: rename again --- Cargo.toml | 6 +++--- README.md | 8 ++++---- derive/Cargo.toml | 4 ++-- derive/src/enum.rs | 2 +- derive/src/lib.rs | 6 +++--- derive/src/struct.rs | 2 +- helpers/Cargo.toml | 2 +- helpers/src/tokenizable.rs | 16 ++++++++-------- tests/test_enum.rs | 2 +- tests/test_struct.rs | 2 +- 10 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1cb9fa1..f162f01 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "quote-it" +name = "quote-data" version = "1.0.0" authors = ["dark-flames "] edition = "2018" @@ -24,8 +24,8 @@ syn = "2.0.75" heck = "0.5.0" quote = { version = "1.0.36", optional = true } proc-macro2 = {version = "1.0.86", optional = true} -derive = { package = "quote-it-codegen", version = "1.0.0", path = "derive" } -helpers = { package = "quote-it-helpers", version = "1.0.0", path = "helpers" } +derive = { package = "quote-data-codegen", version = "1.0.0", path = "derive" } +helpers = { package = "quote-data-helpers", version = "1.0.0", path = "helpers" } [features] diff --git a/README.md b/README.md index d2e1763..e5f1477 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,16 @@ -# quote-it +# quote-data A tokenization Library for Rust. ## Usage -`quote-it` provide derive macro `quote_it::QuoteIt`, +`quote-data` provide derive macro `quote_data::QuoteIt`, which implements `quote::ToTokens` for struct or enum. ```rust -use quote_it::ToTokens; +use quote_data::QuoteIt; use proc_macro2::TokenStream; use quote::quote; -#[derive(ToTokens)] +#[derive(QuoteIt)] struct Foo { a: i32, b: i64 diff --git a/derive/Cargo.toml b/derive/Cargo.toml index 81206d7..702e1cb 100644 --- a/derive/Cargo.toml +++ b/derive/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "quote-it-codegen" +name = "quote-data-codegen" version = "1.0.0" authors = ["dark-flames "] edition = "2018" @@ -16,7 +16,7 @@ syn = "2.0.75" heck = "0.5.0" quote = "1.0.36" proc-macro2 = "1.0.86" -helpers = { package = "quote-it-helpers", version = "1.0.0", path = "../helpers" } +helpers = { package = "quote-data-helpers", version = "1.0.0", path = "../helpers" } [lib] proc-macro=true diff --git a/derive/src/enum.rs b/derive/src/enum.rs index 761c4cf..16cb3d9 100644 --- a/derive/src/enum.rs +++ b/derive/src/enum.rs @@ -71,7 +71,7 @@ impl EnumStructure { Ok(quote! { impl<#generics> quote::ToTokens for #name <#generics_without_bounds> #where_clause { fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) { - use quote_it::Tokenizable; + use quote_data::Tokenizable; match self { #(#variants),* }.to_tokens(tokens); diff --git a/derive/src/lib.rs b/derive/src/lib.rs index 5474c96..084c6e3 100644 --- a/derive/src/lib.rs +++ b/derive/src/lib.rs @@ -25,19 +25,19 @@ pub fn derive_to_tokens(input: TokenStream) -> TokenStream { Expr::Lit(path_lit) => match &path_lit.lit { Lit::Str(path_str) => Ok(path_str.value()), _ => Err(Error::new_spanned( - &mod_path, + mod_path, "`mod_path` must be a string", )) }, _ => Err(Error::new_spanned( - &mod_path, + mod_path, "`mod_path` must be a string", )), } .map(|path| { TokenStream2::from_str(path.as_str()).map_err(|_| { Error::new_spanned( - &mod_path, + mod_path, "Value of `mod_path` must be a path of mod", ) }) diff --git a/derive/src/struct.rs b/derive/src/struct.rs index 4158cd0..8689b36 100644 --- a/derive/src/struct.rs +++ b/derive/src/struct.rs @@ -134,7 +134,7 @@ impl StructStructure { impl<#generics> quote::ToTokens for #name <#generics_without_bounds> #where_clause { fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) { - use quote_it::Tokenizable; + use quote_data::Tokenizable; #(#temp_values;)* (quote::quote! { diff --git a/helpers/Cargo.toml b/helpers/Cargo.toml index 0bb7ced..a8fe22b 100644 --- a/helpers/Cargo.toml +++ b/helpers/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "quote-it-helpers" +name = "quote-data-helpers" version = "1.0.0" authors = ["dark-flames "] edition = "2018" diff --git a/helpers/src/tokenizable.rs b/helpers/src/tokenizable.rs index 74ff86b..f9ea927 100755 --- a/helpers/src/tokenizable.rs +++ b/helpers/src/tokenizable.rs @@ -106,7 +106,7 @@ impl Tokenizable for TokenizableVec { )?; Ok(Some(quote::quote! { - quote_it::TokenizableVec::from_value(#value_path.iter().map( + quote_data::TokenizableVec::from_value(#value_path.iter().map( |item| #wrapped_value ).collect()) })) @@ -154,7 +154,7 @@ impl Tokenizable for TokenizableString { } Ok(Some(quote::quote! { - quote_it::TokenizableString::from_value(#value_path.clone()) + quote_data::TokenizableString::from_value(#value_path.clone()) })) } else { Ok(None) @@ -220,7 +220,7 @@ impl Tokenizable for TokenizableOption { )?; Ok(Some(quote::quote! { - quote_it::TokenizableOption::from_value(#value_path.as_ref().map(|option_value| #wrapped_value)) + quote_data::TokenizableOption::from_value(#value_path.as_ref().map(|option_value| #wrapped_value)) })) } else { Ok(None) @@ -305,7 +305,7 @@ impl Tokenizable for TokenizableResult )?; Ok(Some(quote::quote! { - quote_it::TokenizableResult::from_value( + quote_data::TokenizableResult::from_value( #value_path.clone() .map(|result| #first_wrapped_value) .map_err(|error| #second_wrapped_value) @@ -403,7 +403,7 @@ impl Tokenizable for TokenizableHashMap )?; Ok(Some(quote::quote! { - quote_it::TokenizableHashMap::from_value( + quote_data::TokenizableHashMap::from_value( #value_path.iter().map( |(key, value)| (#first_wrapped_value, #second_wrapped_value) ).collect() @@ -476,7 +476,7 @@ impl Tokenizable for TokenizableHashSet )?; Ok(Some(quote::quote! { - quote_it::TokenizableHashSet::from_value(#value_path.iter().map( + quote_data::TokenizableHashSet::from_value(#value_path.iter().map( |item| #wrapped_value ).collect()) })) @@ -546,7 +546,7 @@ impl Tokenizable for TokenizablePair )?; Ok(Some(quote::quote! { - quote_it::TokenizablePair::from_value((#first, #second)) + quote_data::TokenizablePair::from_value((#first, #second)) })) } else { Ok(None) @@ -591,7 +591,7 @@ impl Tokenizable for TokenizablePhantomData { } Ok(Some(quote::quote! { - quote_it::TokenizablePhantomData::from_value(()) + quote_data::TokenizablePhantomData::from_value(()) })) } else { Ok(None) diff --git a/tests/test_enum.rs b/tests/test_enum.rs index d5020b3..b8c3a9d 100644 --- a/tests/test_enum.rs +++ b/tests/test_enum.rs @@ -1,4 +1,4 @@ -use quote_it::QuoteIt; +use quote_data::QuoteIt; use quote::ToTokens; use std::marker::PhantomData; diff --git a/tests/test_struct.rs b/tests/test_struct.rs index a718e80..923af12 100644 --- a/tests/test_struct.rs +++ b/tests/test_struct.rs @@ -1,5 +1,5 @@ use helpers::TokenizableError; -use quote_it::QuoteIt; +use quote_data::QuoteIt; use quote::ToTokens; use std::collections::{HashMap, HashSet}; use std::marker::PhantomData;