extern crate http_body1_crate as http_body; use auto_enums::enum_derive; enum Enum { A(A), B(B), } impl ::http_body::Body for Enum where A: ::http_body::Body, B: ::http_body::Body< Data = ::Data, Error = ::Error, >, { type Data = ::Data; type Error = ::Error; #[inline] fn is_end_stream(&self) -> bool { match self { Enum::A(x) => ::is_end_stream(x), Enum::B(x) => ::is_end_stream(x), } } #[inline] fn size_hint(&self) -> ::http_body::SizeHint { match self { Enum::A(x) => ::size_hint(x), Enum::B(x) => ::size_hint(x), } } fn poll_frame( self: ::core::pin::Pin<&mut Self>, cx: &mut ::core::task::Context<'_>, ) -> ::core::task::Poll< ::core::option::Option< ::core::result::Result<::http_body::Frame, Self::Error>, >, > { unsafe { match self.get_unchecked_mut() { Enum::A(x) => { ::poll_frame( ::core::pin::Pin::new_unchecked(x), cx, ) } Enum::B(x) => { ::poll_frame( ::core::pin::Pin::new_unchecked(x), cx, ) } } } } } impl ::core::marker::Unpin for Enum where A: ::core::marker::Unpin, B: ::core::marker::Unpin, {} const _: () = { trait MustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] impl MustNotImplDrop for T {} impl MustNotImplDrop for Enum {} }; fn main() {}