derive-name 0.1.0

Derive macro to get name of type (struct/enum) as String.
docs.rs failed to build derive-name-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: derive-name-1.1.0

Name (derive-name)

CI Crate Docs

Derive macro to get name of type (struct/enum) as String.

Usage

use derive_name::Name;

#[derive(Name)]
struct MyStruct;

assert_eq!(MyStruct::name(), "MyStruct");

Manual implementation

use derive_name::Name;

struct MyStruct;

impl Name for MyStruct {
    fn name() -> &'static str {
        "Banana"
    }
}

assert_eq!(MyStruct::name(), "Banana");

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.