Derive Macro scrypto::prelude::ToString

    // Attributes available to this derive:
Expand description

implements std::string::ToString on en enum

// You need to bring the ToString trait into scope to use it
use std::string::ToString;
use strum_macros;

#[derive(strum_macros::ToString, Debug)]
enum Color {
    #[strum(serialize = "redred")]
    Green {
        range: usize,

// uses the serialize string for Display
let red = Color::Red;
assert_eq!(String::from("redred"), red.to_string());
// by default the variants Name
let yellow = Color::Yellow;
assert_eq!(String::from("Yellow"), yellow.to_string());