macro_rules! subtype_of {
($base:ty => $sub:ty | $cerr:ty $check_fn:block) => { ... };
}Expand description
Generation conversion traits for subtype of base.
Syntax:
subtype_of!(Base => Sub | Error { ... })The macro generates four conversion traits for Sub:
Deref<Target=Base>forSubTryFrom<Base, Err=Error>forSubTryFrom<&Base, Err=Error>for&SubTryFrom<&mut Base, Err=Error>for&mut Sub
All traits use the { ... } block which must expand to a Result<(), Error> to check whether or not a conversion is possible.