macro_rules! into_r_infallible {
($ty:ty, |$recv:ident| $body:expr) => { ... };
}Expand description
Generate an infallible IntoR impl whose only real method is into_sexp.
Collapses the four-line boilerplate shell shared by every Infallible
IntoR impl in the optional-type modules: try_into_sexp delegates to
into_sexp, try_into_sexp_unchecked delegates to try_into_sexp, and
into_sexp_unchecked is left as the trait default. Only the into_sexp
body is supplied, as a closure-style |recv| expr binding the receiver
(a macro cannot reuse a self that arrives through a fragment, so the
caller names it). The generated methods are byte-identical to the
hand-written shell, so this is purely a dedup.
ⓘ
into_r_infallible!(Uuid, |this| this.to_string().into_sexp());
into_r_infallible!(Vec<Uuid>,
|this| this.into_iter().map(|u| u.to_string()).collect::<Vec<_>>().into_sexp());