diff options
author | Martin Fischer <martin@push-f.com> | 2021-11-19 11:49:22 +0100 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2021-11-19 12:09:55 +0100 |
commit | 323762d238ebb9d9b8fa65bd1290aaa39648615c (patch) | |
tree | bba4645bf2fef6307018fe9187a19687149cbfbd /src/lib.rs | |
parent | a11255acdf3b3fac12d8f51048f0bed2c0df8a11 (diff) |
if first type bound isn't Into<T> auto-box it
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -365,6 +365,9 @@ impl TypeTransform { fn convert(&self, arg: proc_macro2::TokenStream) -> proc_macro2::TokenStream { match self { TypeTransform::Into => quote! {#arg.into()}, + TypeTransform::Box(box_type) => { + quote! {Box::new(#arg) as #box_type} + } TypeTransform::Map(opt) => { let inner = opt.convert(quote!(x)); quote! {#arg.map(|x| #inner)} |