more-convert: more convert utilities
This crate provides utilities for convert
Usage
more-convert provides a derive macro
EnumReprautomatically implementsTryFromandIntofor enums- Ideal for managing Type, etc.
- Example: test code
Convertautomatically implementsFromorIntofor named structs- Leave the very cumbersome From and Into implementations to us!
- Example From: from's test code
- Example Into: into's test code
Example
EnumRepr
- enum_attributes
- serde: automatically implements
serde::Serializeandserde::Deserialize
- serde: automatically implements
use EnumRepr;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
Convert
- field_attributes
- ignore: skip the field
- rename: rename the field
- map
- map: map of expr
- map_field: map of field
- map_struct: map of struct
use Convert;
let b = B ;
let a: A = b.into;
assert_eq!;
assert_eq!;
more Into examples are here
more From examples are here
License
Licensed under