Skip to content

Commit

Permalink
feat: impl io::Split for DuplexStream (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveLauC authored Oct 23, 2024
1 parent 61af76c commit baf540a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/duplex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,16 @@ impl AsyncWriteRent for DuplexStream {
}
}

/// SAFETY:
///
/// > Users should ensure the read operations are indenpendence from the write
/// > ones, the methods from AsyncReadRent and AsyncWriteRent can execute
/// > concurrently.
///
/// For `DuplexStream`, read and write operate on different `SimplexStream`, so
/// it is definitely safe to split it out.
unsafe impl monoio::io::Split for DuplexStream {}

#[cfg(test)]
mod tests {
use monoio::io::AsyncReadRentExt;
Expand Down

0 comments on commit baf540a

Please sign in to comment.