Name (derive-name)

CI Crate Docs

Derive macro to get the name of a struct or enum.

Usage

```rust use derive_name::Name;

[derive(Name)]

struct Alice;

[derive(Name)]

enum Bob {}

asserteq!(Alice::name(), "Alice"); asserteq!(Bob::name(), "Bob"); ```

Usage with Named

```rust use derive_name::Named;

[derive(derive_name::Name)]

struct Alice;

[derive(derive_name::Name)]

enum Bob { Variant }

let her = Alice {}; let his = Bob::Variant;

asserteq!(her.name(), "Alice"); asserteq!(his.name(), "Bob"); ```

Contributing

If you think you found a bug: open a issue. Feature request are also welcome.

License

This library is distributed under the terms of the ISC License.
Find an easy explanation on choosealicense.com/licenses/isc.