diff options
| author | dyknon dyknonr5fjp | 2025-02-24 18:58:32 +0900 |
|---|---|---|
| committer | dyknon dyknonr5fjp | 2025-02-24 18:58:32 +0900 |
| commit | 6ecbf0d55695335f52d6fcf2b6a22ed45f5e4d99 (patch) | |
| tree | e17bfc8a9b55d5afbfe2f884322a96a54340f25d /src/io.rs | |
| parent | 31b60ae28e6aff6d23b378cd77e288c96c7db148 (diff) | |
Remote camera capability.
Diffstat (limited to 'src/io.rs')
| -rw-r--r-- | src/io.rs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/io.rs b/src/io.rs new file mode 100644 index 0000000..ec47e1d --- /dev/null +++ b/src/io.rs @@ -0,0 +1,37 @@ +use std::io::{Read, Write, Result}; + +pub struct RWBundle<R: Read, W: Write>(pub R, pub W); +impl<R: Read, W: Write> Read for RWBundle<R, W>{ + fn read(&mut self, buf: &mut [u8]) -> Result<usize>{ + self.0.read(buf) + } + //fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>; + //fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>; + //fn read_to_string(&mut self, buf: &mut String) -> Result<usize>; + fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>{ + self.0.read_exact(buf) + } + //fn by_ref(&mut self) -> &mut Self + // where Self: Sized; + //fn bytes(self) -> Bytes<Self> + // where Self: Sized; + //fn chain<R: Read>(self, next: R) -> Chain<Self, R> + // where Self: Sized; + //fn take(self, limit: u64) -> Take<Self> + // where Self: Sized; +} +impl<R: Read, W: Write> Write for RWBundle<R, W>{ + fn write(&mut self, buf: &[u8]) -> Result<usize>{ + self.1.write(buf) + } + fn flush(&mut self) -> Result<()>{ + self.1.flush() + } + //fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize>; + fn write_all(&mut self, buf: &[u8]) -> Result<()>{ + self.1.write_all(buf) + } + //fn write_fmt(&mut self, fmt: Arguments<'_>) -> Result<()>; + //fn by_ref(&mut self) -> &mut Self + // where Self: Sized; +} |
