From: Ian Jackson Date: Sun, 1 Aug 2021 17:49:08 +0000 (+0100) Subject: wip refactor body, move type X-Git-Tag: hippotat/1.0.0~400 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=aecd33f5aa999b4e99560284713573634e814249;p=hippotat.git wip refactor body, move type Signed-off-by: Ian Jackson --- diff --git a/src/bin/client.rs b/src/bin/client.rs index 1d3328d..fef1846 100644 --- a/src/bin/client.rs +++ b/src/bin/client.rs @@ -68,27 +68,27 @@ fn submit_request<'r, 'c:'r, C:HCC>( "#), ); - macro_rules! content { - {} => { - itertools::chain![ - array::IntoIter::new([ - Ok::( prefix1.into() ), - Ok::( prefix2.into() ), - ]).take( - if upbound.is_empty() { 1 } else { 2 } - ), - Itertools::intersperse( - upbound.into_iter().map(|u| Bytes::from(u)), - SLIP_END_SLICE.into() - ).map(Ok::), - [ Ok::( suffix.into() ) ], - ] - } - } + macro_rules! content { { + $out:ty + } => { + itertools::chain![ + array::IntoIter::new([ + Ok::<$out,Void>( prefix1.into() ), + Ok::<$out,Void>( prefix2.into() ), + ]).take( + if upbound.is_empty() { 1 } else { 2 } + ), + Itertools::intersperse( + upbound.into_iter().map(|u| { let out: $out = u.into(); out }), + SLIP_END_SLICE.into() + ).map(Ok::<$out,Void>), + [ Ok::<$out,Void>( suffix.into() ) ], + ] + }} let body = hyper::body::Body::wrap_stream( futures::stream::iter( - content!() + content!( Bytes ) ) );