Skip to content

Commit f8a2339

Browse files
authored
Merge pull request #32 from dignifiedquire/feat-no-send-bound
feat: remove not required `Send` bound
2 parents 0250d52 + 6a86e90 commit f8a2339

2 files changed

Lines changed: 16 additions & 16 deletions

File tree

src/reader.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub trait VarIntReader {
2525

2626
#[cfg(any(feature = "tokio_async", feature = "futures_async"))]
2727
/// Like a VarIntReader, but returns a future.
28-
#[async_trait::async_trait]
28+
#[async_trait::async_trait(?Send)]
2929
pub trait VarIntAsyncReader {
3030
async fn read_varint_async<VI: VarInt>(&mut self) -> Result<VI>;
3131
}
@@ -65,8 +65,8 @@ impl VarIntProcessor {
6565
}
6666

6767
#[cfg(any(feature = "tokio_async", feature = "futures_async"))]
68-
#[async_trait::async_trait]
69-
impl<AR: AsyncRead + Unpin + Send> VarIntAsyncReader for AR {
68+
#[async_trait::async_trait(?Send)]
69+
impl<AR: AsyncRead + Unpin> VarIntAsyncReader for AR {
7070
async fn read_varint_async<VI: VarInt>(&mut self) -> Result<VI> {
7171
let mut buf = [0 as u8; 1];
7272
let mut p = VarIntProcessor::new::<VI>();
@@ -124,14 +124,14 @@ pub trait FixedIntReader {
124124

125125
/// Like FixedIntReader, but returns a future.
126126
#[cfg(any(feature = "tokio_async", feature = "futures_async"))]
127-
#[async_trait::async_trait]
127+
#[async_trait::async_trait(?Send)]
128128
pub trait FixedIntAsyncReader {
129129
async fn read_fixedint_async<FI: FixedInt>(&mut self) -> Result<FI>;
130130
}
131131

132132
#[cfg(any(feature = "tokio_async", feature = "futures_async"))]
133-
#[async_trait::async_trait]
134-
impl<AR: AsyncRead + Unpin + Send> FixedIntAsyncReader for AR {
133+
#[async_trait::async_trait(?Send)]
134+
impl<AR: AsyncRead + Unpin> FixedIntAsyncReader for AR {
135135
async fn read_fixedint_async<FI: FixedInt>(&mut self) -> Result<FI> {
136136
let mut buf = [0 as u8; 8];
137137
self.read_exact(&mut buf[0..std::mem::size_of::<FI>()])

src/writer.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ pub trait VarIntWriter {
1717

1818
/// Like VarIntWriter, but asynchronous.
1919
#[cfg(any(feature = "tokio_async", feature = "futures_async"))]
20-
#[async_trait::async_trait]
20+
#[async_trait::async_trait(?Send)]
2121
pub trait VarIntAsyncWriter {
2222
/// Write a VarInt integer to an asynchronous writer.
23-
async fn write_varint_async<VI: VarInt + Send>(&mut self, n: VI) -> Result<usize>;
23+
async fn write_varint_async<VI: VarInt>(&mut self, n: VI) -> Result<usize>;
2424
}
2525

2626
#[cfg(any(feature = "tokio_async", feature = "futures_async"))]
27-
#[async_trait::async_trait]
28-
impl<AW: AsyncWrite + Send + Unpin> VarIntAsyncWriter for AW {
29-
async fn write_varint_async<VI: VarInt + Send>(&mut self, n: VI) -> Result<usize> {
27+
#[async_trait::async_trait(?Send)]
28+
impl<AW: AsyncWrite + Unpin> VarIntAsyncWriter for AW {
29+
async fn write_varint_async<VI: VarInt>(&mut self, n: VI) -> Result<usize> {
3030
let mut buf = [0 as u8; 10];
3131
let b = n.encode_var(&mut buf);
3232
self.write_all(&buf[0..b]).await?;
@@ -50,15 +50,15 @@ pub trait FixedIntWriter {
5050
}
5151

5252
#[cfg(any(feature = "tokio_async", feature = "futures_async"))]
53-
#[async_trait::async_trait]
53+
#[async_trait::async_trait(?Send)]
5454
pub trait FixedIntAsyncWriter {
55-
async fn write_fixedint_async<FI: FixedInt + Send>(&mut self, n: FI) -> Result<usize>;
55+
async fn write_fixedint_async<FI: FixedInt>(&mut self, n: FI) -> Result<usize>;
5656
}
5757

5858
#[cfg(any(feature = "tokio_async", feature = "futures_async"))]
59-
#[async_trait::async_trait]
60-
impl<AW: AsyncWrite + Unpin + Send> FixedIntAsyncWriter for AW {
61-
async fn write_fixedint_async<FI: FixedInt + Send>(&mut self, n: FI) -> Result<usize> {
59+
#[async_trait::async_trait(?Send)]
60+
impl<AW: AsyncWrite + Unpin> FixedIntAsyncWriter for AW {
61+
async fn write_fixedint_async<FI: FixedInt>(&mut self, n: FI) -> Result<usize> {
6262
let mut buf = [0 as u8; 8];
6363
n.encode_fixed(&mut buf[..std::mem::size_of::<FI>()]);
6464
self.write_all(&buf[..std::mem::size_of::<FI>()]).await?;

0 commit comments

Comments
 (0)