| Crates.io | named-types |
| lib.rs | named-types |
| version | 0.1.1 |
| created_at | 2023-07-24 11:36:05.316241+00 |
| updated_at | 2023-07-28 08:19:48.962576+00 |
| description | Like Display or Debug but for type names. |
| homepage | |
| repository | https://github.com/pdamianik/named-types-rs |
| max_upload_size | |
| id | 924500 |
| size | 98,113 |
Like Display or Debug but for type names.
This crate provides Named, a trait that provides a core::fmt::Displayable way to get a types Name.
It is similar to core::any::type_name without paths, but should provide a more sensical name for
something like std::io::Error, which would show up as Error with something like pretty-type-name,
whereas this crate provides the name IoError.
The names for std are given based on the Duck Test, e.g.
core::slice::Iter stays Iter conflicting with something like core::option::Iter because they behave
like generic iterators, whereas std::io::Error does not behave like a generic Error but rather is a
specific Error type for io operations.
Additionally a Named derive macro is provided for deriving the Named trait. This macro can be configured by attributing a derived type with #[named(...)]. The following options can be passed to the attribute:
To configure multiple options repeat the #[named(...)] attribute.