Skip to content

Commit

Permalink
fix macro doc test
Browse files Browse the repository at this point in the history
  • Loading branch information
carloskiki committed Sep 24, 2023
1 parent bc98bf8 commit 6134999
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 14 deletions.
10 changes: 3 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ members = [
"icondata_vs",
"icondata_wi",
"icondata_core",
"icondata_macros"
]
exclude = ["build", "icondata_macros"]
2 changes: 1 addition & 1 deletion build/templates/main_lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ categories = ["web-programming"]
[dependencies]
icondata_core = "0.0.2"
serde = { version = "1", optional = true }
icondata_macros = { version = "0.1.2", optional = true }
icondata_macros = { version = "0.1.4", optional = true }

{% for (short_name, version) in sn_version -%}
icondata_{{short_name}} = { version = "{{version}}", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion icondata/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ categories = ["web-programming"]
[dependencies]
icondata_core = "0.0.2"
serde = { version = "1", optional = true }
icondata_macros = { version = "0.1.2", optional = true }
icondata_macros = { version = "0.1.4", optional = true }

icondata_ai = { version = "0.0.8", optional = true }
icondata_bi = { version = "0.0.8", optional = true }
Expand Down
5 changes: 4 additions & 1 deletion icondata_macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "icondata_macros"
version = "0.1.2"
version = "0.1.4"
edition = "2021"
authors = ["Charles Edward Gagnon"]
license = "MIT"
Expand All @@ -13,3 +13,6 @@ keywords = ["icons", "svg", "macro"]

[lib]
proc-macro = true

[dev-dependencies]
icondata = { path = "../icondata", features = ["AiFileImageTwotone", "macros"] }
10 changes: 7 additions & 3 deletions icondata_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ extern crate proc_macro;
///
/// ### Example
/// ```
/// use icondata::{icon, Icon};
///
///
/// let icon: Icon = icon!(AiFileImageTwotone);
/// assert_eq!(icon, Icon::from(icondata::AiFileImageTwotone));
/// // Instead of:
/// let icon: Icon = Icon::from(AiIcon::AiFileImageTwotone);
/// // let icon: Icon = Icon::from(AiIcon::AiFileImageTwotone);
/// ```
#[proc_macro]
pub fn icon(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
Expand All @@ -31,8 +35,8 @@ pub fn icon(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
let (lib_short_name, icon_name) = icon_string.split_at(2);

format!(
"Icon::from({}Icon::{}{})",
lib_short_name, lib_short_name, icon_name
"icondata::Icon::from(icondata::{}{})",
lib_short_name, icon_name
)
.parse()
.unwrap()
Expand Down

0 comments on commit 6134999

Please sign in to comment.