Procedural macro for easily creating multiple linked marker types, useful for the typestate pattern.
By default, typemarker adds both a trait and a dynamic value for the marker enum called "Trait" and "Dynamic" respectively.
```rust use core::marker::PhantomData;
use typemarker::typemarker;
enum LightColor { Red, Yellow, Green, }
struct TrafficLight
impl
let light = TrafficLight::
let light = light.turngreen(); assert!(light.cango()); ```
Both the trait and the dynamic value can be disabled using no_value
and no_trait
respectively.
```rust use core::marker::PhantomData;
use typemarker::typemarker;
enum LightColor { Red, Yellow, Green, }
// Compile error, LightColor::Trait does not exist on no_trait.
// struct TrafficLight
struct TrafficLight
// Compile error, dynamic doesn't exist on novalue.
// impl
let light = TrafficLight::
They can also be renamed using trait_name = ...
and value_name = ...
:
```rust use core::marker::PhantomData;
use typemarker::typemarker;
enum LightColor { Red, Yellow, Green, }
struct TrafficLight
impl
let light = TrafficLight::
let light = light.turngreen(); assert!(light.cango()); ```