extern crate tokio1_crate as tokio; use auto_enums::enum_derive; enum Enum { A(A), B(B), } impl ::tokio::io::AsyncSeek for Enum where A: ::tokio::io::AsyncSeek, B: ::tokio::io::AsyncSeek, { fn start_seek( self: ::core::pin::Pin<&mut Self>, pos: ::std::io::SeekFrom, ) -> ::std::io::Result<()> { unsafe { match self.get_unchecked_mut() { Enum::A(x) => { ::start_seek( ::core::pin::Pin::new_unchecked(x), pos, ) } Enum::B(x) => { ::start_seek( ::core::pin::Pin::new_unchecked(x), pos, ) } } } } fn poll_complete( self: ::core::pin::Pin<&mut Self>, cx: &mut ::core::task::Context<'_>, ) -> ::core::task::Poll<::std::io::Result> { unsafe { match self.get_unchecked_mut() { Enum::A(x) => { ::poll_complete( ::core::pin::Pin::new_unchecked(x), cx, ) } Enum::B(x) => { ::poll_complete( ::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() {}