Debian Codegraph @

third_party/rust/minidump/src/iostuff.rs

raw
1 // Copyright 2015 Ted Mielczarek. See the COPYRIGHT
2 // file at the top-level directory of this distribution.
3
4 //! General-purpose I/O routines.
5
6 use std::io;
7 use std::io::prelude::*;
8
9 /// Shorthand for Read + Seek
10 pub trait Readable: Read + Seek {}
11 impl<T: Read + Seek> Readable for T {}
12
13 /// Format `bytes` to `f` as a hex string.
14 pub fn write_bytes<T: Write>(f: &mut T, bytes: &[u8]) -> io::Result<()> {
15 for b in bytes {
16 write!(f, "{b:02x}")?;
17 }
18 Ok(())
19 }