Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions embedded-io-async/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,15 @@ pub trait Seek: ErrorType {
self.seek(SeekFrom::Current(0)).await
}
}

/// Split a stream in a reader and writer, which are independent
pub trait SplitRW {
/// Reader type of the split stream
type Reader: Read;

/// Writer type of the split stream
type Writer: Write;

/// Split a stream in a independent reader and writer
fn split_rw(&mut self) -> (Self::Reader, Self::Writer);
}
12 changes: 12 additions & 0 deletions embedded-io/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -566,3 +566,15 @@ pub trait WriteReady: ErrorType {
/// If this returns `true`, it's guaranteed that the next call to [`Write::write`] will not block.
fn write_ready(&mut self) -> Result<bool, Self::Error>;
}

/// Split a stream in a reader and writer, which are independent
pub trait SplitRW {
/// Reader type of the split stream
type Reader: Read;

/// Writer type of the split stream
type Writer: Write;

/// Split a stream in a independent reader and writer
fn split_rw(&mut self) -> (Self::Reader, Self::Writer);
}
Loading