Skip to content

Commit baf540a

Browse files
authored
feat: impl io::Split for DuplexStream (#6)
1 parent 61af76c commit baf540a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/duplex.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,16 @@ impl AsyncWriteRent for DuplexStream {
123123
}
124124
}
125125

126+
/// SAFETY:
127+
///
128+
/// > Users should ensure the read operations are indenpendence from the write
129+
/// > ones, the methods from AsyncReadRent and AsyncWriteRent can execute
130+
/// > concurrently.
131+
///
132+
/// For `DuplexStream`, read and write operate on different `SimplexStream`, so
133+
/// it is definitely safe to split it out.
134+
unsafe impl monoio::io::Split for DuplexStream {}
135+
126136
#[cfg(test)]
127137
mod tests {
128138
use monoio::io::AsyncReadRentExt;

0 commit comments

Comments
 (0)