Crates.io | fast_enum_conversion |
lib.rs | fast_enum_conversion |
version | 0.1.0 |
source | src |
created_at | 2024-01-18 12:21:45.972199 |
updated_at | 2024-01-18 12:21:45.972199 |
description | Zerocost conversion between enums |
homepage | |
repository | https://github.com/yasuo-ozu/fast_enum_conversion |
max_upload_size | |
id | 1104147 |
size | 8,164 |
This crate provides zerocost conversion between enums. An enum Src
can be converted to another enum Dest
when the following satisfies:
Src
, counterparts exist in Dest
.Here, an variant ans its "counterpart" satisfies all of them:
Fields
of both variants are equal. For example, one has structural fields, another should have the same.Fields
are the same.It performs zerocost conversion when following satisfies for all counterparts:
std::mem::Discriminant
] of them are equal.