Skip to content

Commit 00217a9

Browse files
committed
Make it easier to use IronRDP with Tokio
1 parent 55176ff commit 00217a9

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

crates/ironrdp-async/src/framed.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,17 @@ pub trait FramedRead {
1111
fn read<'a>(
1212
&'a mut self,
1313
buf: &'a mut BytesMut,
14-
) -> Pin<Box<dyn std::future::Future<Output = io::Result<usize>> + 'a>>
14+
) -> Pin<Box<dyn std::future::Future<Output = io::Result<usize>> + 'a + Send>>
1515
where
1616
Self: 'a;
1717
}
1818

1919
pub trait FramedWrite {
2020
/// Writes an entire buffer into this stream.
21-
fn write_all<'a>(&'a mut self, buf: &'a [u8]) -> Pin<Box<dyn std::future::Future<Output = io::Result<()>> + 'a>>
21+
fn write_all<'a>(
22+
&'a mut self,
23+
buf: &'a [u8],
24+
) -> Pin<Box<dyn std::future::Future<Output = io::Result<()>> + 'a + Send>>
2225
where
2326
Self: 'a;
2427
}

crates/ironrdp-futures/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ impl<S> FramedWrite for FuturesStream<S>
6161
where
6262
S: Unpin + AsyncWrite,
6363
{
64-
fn write_all<'a>(&'a mut self, buf: &'a [u8]) -> Pin<Box<dyn std::future::Future<Output = io::Result<()>> + 'a>>
64+
fn write_all<'a>(
65+
&'a mut self,
66+
buf: &'a [u8],
67+
) -> Pin<Box<dyn std::future::Future<Output = io::Result<()>> + 'a + Send>>
6568
where
6669
Self: 'a,
6770
{

crates/ironrdp-pdu/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ pub fn find_size(bytes: &[u8]) -> PduResult<Option<PduInfo>> {
282282
}
283283
}
284284

285-
pub trait PduHint: core::fmt::Debug {
285+
pub trait PduHint: core::fmt::Debug + Sync {
286286
/// Finds next PDU size by reading the next few bytes.
287287
fn find_size(&self, bytes: &[u8]) -> PduResult<Option<usize>>;
288288
}

crates/ironrdp-tokio/src/lib.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ impl<S> StreamWrapper for TokioStream<S> {
3333

3434
impl<S> FramedRead for TokioStream<S>
3535
where
36-
S: Unpin + AsyncRead,
36+
S: Unpin + AsyncRead + Send,
3737
{
3838
fn read<'a>(
3939
&'a mut self,
4040
buf: &'a mut BytesMut,
41-
) -> Pin<Box<dyn std::future::Future<Output = io::Result<usize>> + 'a>>
41+
) -> Pin<Box<dyn std::future::Future<Output = io::Result<usize>> + 'a + Send>>
4242
where
43-
Self: 'a,
43+
Self: 'a + Send,
4444
{
4545
use tokio::io::AsyncReadExt as _;
4646

@@ -50,9 +50,12 @@ where
5050

5151
impl<S> FramedWrite for TokioStream<S>
5252
where
53-
S: Unpin + AsyncWrite,
53+
S: Unpin + AsyncWrite + Send,
5454
{
55-
fn write_all<'a>(&'a mut self, buf: &'a [u8]) -> Pin<Box<dyn std::future::Future<Output = io::Result<()>> + 'a>>
55+
fn write_all<'a>(
56+
&'a mut self,
57+
buf: &'a [u8],
58+
) -> Pin<Box<dyn std::future::Future<Output = io::Result<()>> + 'a + Send>>
5659
where
5760
Self: 'a,
5861
{

0 commit comments

Comments
 (0)