diff --git a/src/reader.rs b/src/reader.rs index 7a066c3..71e440c 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -25,7 +25,7 @@ pub trait VarIntReader { #[cfg(any(feature = "tokio_async", feature = "futures_async"))] /// Like a VarIntReader, but returns a future. -#[async_trait::async_trait] +#[async_trait::async_trait(?Send)] pub trait VarIntAsyncReader { async fn read_varint_async(&mut self) -> Result; } @@ -65,8 +65,8 @@ impl VarIntProcessor { } #[cfg(any(feature = "tokio_async", feature = "futures_async"))] -#[async_trait::async_trait] -impl VarIntAsyncReader for AR { +#[async_trait::async_trait(?Send)] +impl VarIntAsyncReader for AR { async fn read_varint_async(&mut self) -> Result { let mut buf = [0 as u8; 1]; let mut p = VarIntProcessor::new::(); @@ -124,14 +124,14 @@ pub trait FixedIntReader { /// Like FixedIntReader, but returns a future. #[cfg(any(feature = "tokio_async", feature = "futures_async"))] -#[async_trait::async_trait] +#[async_trait::async_trait(?Send)] pub trait FixedIntAsyncReader { async fn read_fixedint_async(&mut self) -> Result; } #[cfg(any(feature = "tokio_async", feature = "futures_async"))] -#[async_trait::async_trait] -impl FixedIntAsyncReader for AR { +#[async_trait::async_trait(?Send)] +impl FixedIntAsyncReader for AR { async fn read_fixedint_async(&mut self) -> Result { let mut buf = [0 as u8; 8]; self.read_exact(&mut buf[0..std::mem::size_of::()]) diff --git a/src/writer.rs b/src/writer.rs index c2d2ff3..e7799ea 100644 --- a/src/writer.rs +++ b/src/writer.rs @@ -17,16 +17,16 @@ pub trait VarIntWriter { /// Like VarIntWriter, but asynchronous. #[cfg(any(feature = "tokio_async", feature = "futures_async"))] -#[async_trait::async_trait] +#[async_trait::async_trait(?Send)] pub trait VarIntAsyncWriter { /// Write a VarInt integer to an asynchronous writer. - async fn write_varint_async(&mut self, n: VI) -> Result; + async fn write_varint_async(&mut self, n: VI) -> Result; } #[cfg(any(feature = "tokio_async", feature = "futures_async"))] -#[async_trait::async_trait] -impl VarIntAsyncWriter for AW { - async fn write_varint_async(&mut self, n: VI) -> Result { +#[async_trait::async_trait(?Send)] +impl VarIntAsyncWriter for AW { + async fn write_varint_async(&mut self, n: VI) -> Result { let mut buf = [0 as u8; 10]; let b = n.encode_var(&mut buf); self.write_all(&buf[0..b]).await?; @@ -50,15 +50,15 @@ pub trait FixedIntWriter { } #[cfg(any(feature = "tokio_async", feature = "futures_async"))] -#[async_trait::async_trait] +#[async_trait::async_trait(?Send)] pub trait FixedIntAsyncWriter { - async fn write_fixedint_async(&mut self, n: FI) -> Result; + async fn write_fixedint_async(&mut self, n: FI) -> Result; } #[cfg(any(feature = "tokio_async", feature = "futures_async"))] -#[async_trait::async_trait] -impl FixedIntAsyncWriter for AW { - async fn write_fixedint_async(&mut self, n: FI) -> Result { +#[async_trait::async_trait(?Send)] +impl FixedIntAsyncWriter for AW { + async fn write_fixedint_async(&mut self, n: FI) -> Result { let mut buf = [0 as u8; 8]; n.encode_fixed(&mut buf[..std::mem::size_of::()]); self.write_all(&buf[..std::mem::size_of::()]).await?;