From 77dd62045d351f3742e9a13cb6dc4ba676ba5984 Mon Sep 17 00:00:00 2001 From: Azriel Hoh Date: Mon, 12 Feb 2024 19:47:12 +1300 Subject: [PATCH] Update crate version to `0.1.10`. --- CHANGELOG.md | 2 +- Cargo.toml | 2 +- README.md | 16 ++++++++++------ README.tpl | 4 ++-- src/lib.rs | 2 +- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f78a895..6c7a475 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## unreleased +## 0.1.10 (2024-02-12) * Add `TypeNameInfo` gated behind `"info"` and `"serde"` features. ([#16]) diff --git a/Cargo.toml b/Cargo.toml index bafdd90..b70bb19 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tynm" -version = "0.1.9" +version = "0.1.10" authors = ["Azriel Hoh "] edition = "2021" description = "Returns type names in shorter form." diff --git a/README.md b/README.md index d32068c..2b8691b 100644 --- a/README.md +++ b/README.md @@ -12,12 +12,18 @@ Returns type names with a specifiable number of module segments as a `String`. Add the following to `Cargo.toml` ```toml -tynm = "0.1.8" +tynm = "0.1.10" ``` In code: ```rust +#[rustfmt::skip] +assert_eq!( + core::any::type_name::>(), "core::option::Option" +); + +#[rustfmt::skip] let tuples = vec![ (tynm::type_name::>(), "Option"), (tynm::type_namem::>(1), "core::..::Option"), @@ -26,26 +32,24 @@ let tuples = vec![ (tynm::type_namemn::(1, 1), "rust_out::..::three::Struct"), // traits (tynm::type_name::(), "dyn Debug"), - - // core / std - (core::any::type_name::>(), "core::option::Option") ]; tuples .iter() .for_each(|(left, right)| assert_eq!(left, right)); + ``` ## Motivation -The [`std::any::type_name`] function stabilized in Rust 1.38 returns the fully qualified type +The [`core::any::type_name`] function stabilized in Rust 1.38 returns the fully qualified type name with all module segments. This can be difficult to read in error messages, especially for type-parameterized types. Often, the simple type name is more readable, and enough to distinguish the type referenced in an error. -[`std::any::type_name`]: https://doc.rust-lang.org/std/any/fn.type_name.html +[`core::any::type_name`]: https://doc.rust-lang.org/std/any/fn.type_name.html ## License diff --git a/README.tpl b/README.tpl index 8485a25..700ff04 100644 --- a/README.tpl +++ b/README.tpl @@ -1,10 +1,10 @@ +# 🪶 Tynm -- Type Name + [![Crates.io](https://img.shields.io/crates/v/tynm.svg)](https://crates.io/crates/tynm) [![docs.rs](https://img.shields.io/docsrs/tynm)](https://docs.rs/tynm) [![CI](https://github.com/azriel91/tynm/workflows/CI/badge.svg)](https://github.com/azriel91/tynm/actions/workflows/ci.yml) [![Coverage Status](https://codecov.io/gh/azriel91/tynm/branch/main/graph/badge.svg)](https://codecov.io/gh/azriel91/tynm) -# Tynm -- Type Name - {{readme}} ## License diff --git a/src/lib.rs b/src/lib.rs index 60eb36e..d88ca6f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,7 +8,7 @@ //! Add the following to `Cargo.toml` //! //! ```toml -//! tynm = "0.1.8" +//! tynm = "0.1.10" //! ``` //! //! In code: