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