Skip to content

Commit

Permalink
Update crate version to 0.1.10.
Browse files Browse the repository at this point in the history
  • Loading branch information
azriel91 committed Feb 12, 2024
1 parent 0f6c4dd commit 77dd620
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## unreleased
## 0.1.10 (2024-02-12)

* Add `TypeNameInfo` gated behind `"info"` and `"serde"` features. ([#16])

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tynm"
version = "0.1.9"
version = "0.1.10"
authors = ["Azriel Hoh <[email protected]>"]
edition = "2021"
description = "Returns type names in shorter form."
Expand Down
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Option<String>>(), "core::option::Option<alloc::string::String>"
);

#[rustfmt::skip]
let tuples = vec![
(tynm::type_name::<Option<String>>(), "Option<String>"),
(tynm::type_namem::<Option<String>>(1), "core::..::Option<alloc::..::String>"),
Expand All @@ -26,26 +32,24 @@ let tuples = vec![
(tynm::type_namemn::<rust_out::two::three::Struct>(1, 1), "rust_out::..::three::Struct"),
// traits
(tynm::type_name::<dyn core::fmt::Debug>(), "dyn Debug"),

// core / std
(core::any::type_name::<Option<String>>(), "core::option::Option<alloc::string::String>")
];

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

Expand Down
4 changes: 2 additions & 2 deletions README.tpl
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//! Add the following to `Cargo.toml`
//!
//! ```toml
//! tynm = "0.1.8"
//! tynm = "0.1.10"
//! ```
//!
//! In code:
Expand Down

0 comments on commit 77dd620

Please sign in to comment.