diff options
author | Nora Widdecke <nora@sequoia-pgp.org> | 2020-11-02 10:24:25 +0100 |
---|---|---|
committer | Nora Widdecke <nora@sequoia-pgp.org> | 2020-11-09 13:06:59 +0100 |
commit | 8712c52b31b1ed16a1470adb46cf3f7fd7cc65e8 (patch) | |
tree | 8b9758728c041ea0e666d6c4b08d268415100e3b /buffered-reader/src/file_generic.rs | |
parent | 41bcc909751d8f465e2c557276f53935d54e5e9c (diff) |
buffered-reader: Add Debug trait bound to Cookie.
Diffstat (limited to 'buffered-reader/src/file_generic.rs')
-rw-r--r-- | buffered-reader/src/file_generic.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/buffered-reader/src/file_generic.rs b/buffered-reader/src/file_generic.rs index 0a073165..4a1cb830 100644 --- a/buffered-reader/src/file_generic.rs +++ b/buffered-reader/src/file_generic.rs @@ -10,15 +10,15 @@ use crate::file_error::FileError; /// /// This is a generic implementation that may be replaced by /// platform-specific versions. -pub struct File<C>(Generic<fs::File, C>, PathBuf); +pub struct File<C: fmt::Debug>(Generic<fs::File, C>, PathBuf); -impl<C> fmt::Display for File<C> { +impl<C: fmt::Debug> fmt::Display for File<C> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "File {:?}", self.1.display()) } } -impl<C> fmt::Debug for File<C> { +impl<C: fmt::Debug> fmt::Debug for File<C> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_tuple("File") .field(&self.0) @@ -34,7 +34,7 @@ impl File<()> { } } -impl<C> File<C> { +impl<C: fmt::Debug> File<C> { /// Like `open()`, but sets a cookie. pub fn with_cookie<P: AsRef<Path>>(path: P, cookie: C) -> io::Result<Self> { let path = path.as_ref(); @@ -43,14 +43,14 @@ impl<C> File<C> { } } -impl<C> io::Read for File<C> { +impl<C: fmt::Debug> io::Read for File<C> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { self.0.read(buf) .map_err(|e| FileError::new(&self.1, e)) } } -impl<C> BufferedReader<C> for File<C> { +impl<C: fmt::Debug> BufferedReader<C> for File<C> { fn buffer(&self) -> &[u8] { self.0.buffer() } |