extern crate futures03_crate as futures; use auto_enums::enum_derive; enum Enum { A(A), B(B), } impl ::futures::io::AsyncRead for Enum where A: ::futures::io::AsyncRead, B: ::futures::io::AsyncRead, { #[inline] fn poll_read( self: ::core::pin::Pin<&mut Self>, cx: &mut ::core::task::Context<'_>, buf: &mut [u8], ) -> ::core::task::Poll<::std::io::Result> { unsafe { match self.get_unchecked_mut() { Enum::A(x) => { ::poll_read( ::core::pin::Pin::new_unchecked(x), cx, buf, ) } Enum::B(x) => { ::poll_read( ::core::pin::Pin::new_unchecked(x), cx, buf, ) } } } } #[inline] fn poll_read_vectored( self: ::core::pin::Pin<&mut Self>, cx: &mut ::core::task::Context<'_>, bufs: &mut [::std::io::IoSliceMut<'_>], ) -> ::core::task::Poll<::std::io::Result> { unsafe { match self.get_unchecked_mut() { Enum::A(x) => { ::poll_read_vectored( ::core::pin::Pin::new_unchecked(x), cx, bufs, ) } Enum::B(x) => { ::poll_read_vectored( ::core::pin::Pin::new_unchecked(x), cx, bufs, ) } } } } } 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() {}