From 6ecbf0d55695335f52d6fcf2b6a22ed45f5e4d99 Mon Sep 17 00:00:00 2001 From: dyknon Date: Mon, 24 Feb 2025 18:58:32 +0900 Subject: Remote camera capability. --- src/io.rs | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/io.rs (limited to 'src/io.rs') 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(pub R, pub W); +impl Read for RWBundle{ + fn read(&mut self, buf: &mut [u8]) -> Result{ + self.0.read(buf) + } + //fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result; + //fn read_to_end(&mut self, buf: &mut Vec) -> Result; + //fn read_to_string(&mut self, buf: &mut String) -> Result; + 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 + // where Self: Sized; + //fn chain(self, next: R) -> Chain + // where Self: Sized; + //fn take(self, limit: u64) -> Take + // where Self: Sized; +} +impl Write for RWBundle{ + fn write(&mut self, buf: &[u8]) -> Result{ + self.1.write(buf) + } + fn flush(&mut self) -> Result<()>{ + self.1.flush() + } + //fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result; + 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; +} -- cgit v1.2.3