Skip to content

Commit 71b5a96

Browse files
sukhmelVladislav.Sukhmel
authored andcommitted
fix: use full path in code generation impl tagname::TagName
* Explicit path to tagname::TagName impl added to tagname_derive In order to be able to use `#[derive(tagname::TagName)]` in autogenerated code with little to no control over used imports an explicit trait path is necessary. This happens for instance with generating from proto-files with tonic_build * README.md fixed to have correct `#[tag(...)]` attributes Co-authored-by: Vladislav.Sukhmel <[email protected]>
1 parent 7ddbac4 commit 71b5a96

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "tagname"
3-
version = "0.3.0"
3+
version = "0.3.1"
44
edition = "2021"
55
authors = ["Krzysztof Hrynczenko <[email protected]>"]
66
description = "get the name of a variant in your enum as a string"
@@ -12,7 +12,7 @@ readme = "README.md"
1212
license = "MIT"
1313

1414
[dependencies]
15-
tagname_derive = { version = "0.3.0", path = "tagname_derive" }
15+
tagname_derive = { version = "0.3.1", path = "tagname_derive" }
1616

1717
[workspace]
1818
members = ["tagname_derive"]

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ use tagname::TagName;
1616

1717
#[derive(TagName)]
1818
enum MyTaggedUnion {
19-
[tag(case = "lower")]
19+
#[tag(case = "lower")]
2020
Yes,
21-
[tag(case = "upper")]
21+
#[tag(case = "upper")]
2222
No,
2323
Maybe(usize),
2424
}

tagname_derive/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "tagname_derive"
3-
version = "0.3.0"
3+
version = "0.3.1"
44
edition = "2021"
55
authors = ["Krzysztof Hrynczenko <[email protected]>"]
66
description = "derive(TagName) implementation"

tagname_derive/src/generation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub(crate) fn generate_code(tagged_union: TaggedUnion) -> TokenStream {
1414
.collect();
1515

1616
let gen = quote! {
17-
impl TagName for #name {
17+
impl tagname::TagName for #name {
1818
fn tag_name(&self) -> &'static str {
1919
match self {
2020
#(#match_arms)*

0 commit comments

Comments
 (0)