docs.rs failed to build seoul-derive-0.2.1
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.
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:
seoul-derive-1.0.0
Seoul-Rs
Trait Isomorphism
-
To handle enum data type. Convenient transformation of enum values with derive macro.
-
Basic methods:
fn title(&self) -> String;fn list() -> Vec<Self>;
-
Using derive macro, also are implemented
Into<T>forSelfand&SelfFrom<T>andFrom<&T>forSelf(whenDefaultis implemented and "has_default" syntax is given)
derive syntax and fallback
- When title is not given at variant level, the variant's name (Ident) will be used as titile.
- When list is not given at the top level attribute, list of each variant's default format will be returned.
- When into value is not given at variant level, the into type(T)'s default value will be used in
<Into<T>>trait. - When the type implements
Defaultand has_default is given at top level attribute, theFrom<T>andFrom<&T>will be implemented for each given into types(T).
Examples
use Isomorphism;
// `list()`
let list = ABClist;
assert_eq!;
let a: ABC = ABCA;
let b = ABCB;
let c = ABCC;
// `title()`
assert_eq!;
assert_eq!;
assert_eq!;
// `Into<T>` for `&Self` and `Self`
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
// list
assert_eq!;
// Into
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
// From
assert_eq!;
assert_eq!;
// fallback to default value of `CD`
assert_eq!;
Dev Log
- ver.0.2.0
From<T>implemented only withhas_defaultattribute syntax whenDefaultis implemented.
- ver 0.2.1
- correct some typos