Crates.io | enum_from_derive |
lib.rs | enum_from_derive |
version | 0.1.6 |
source | src |
created_at | 2024-08-22 06:11:55.462066 |
updated_at | 2024-11-15 07:23:42.71216 |
description | Implement From For the Enumeration |
homepage | https://github.com/ptechen |
repository | https://github.com/ptechen/enum_from_derive.git |
max_upload_size | |
id | 1347311 |
size | 11,780 |
use enum_from_derive::From;
#[repr(i32)]
#[derive(From, Debug)]
pub enum Test {
#[default]
Name,
#[from_str(test)]
#[False]
Test = 100,
#[False]
TTT,
#[True]
FFF = 1000
}
#[test]
fn test() {
let t = Test::from("test1");
println!("{:?}", t);
let t = Test::from(100);
println!("{:?}", t);
println!("{}", a.to_bool())
}