dw.finish().0
};
let kind = bundles::Kind::only();
- f.seek(io::SeekFrom::Start(0)).context("rewind bundle file")?;
+ f.rewind().context("rewind bundle file")?;
let cmd = MC::UploadBundle {
game: instance_name.clone(),
hash: bundles::Hash(hash.into()), kind,
pub use std::io;
pub use std::io::ErrorKind;
pub use std::io::{BufRead, BufReader, BufWriter, Read, Write};
-pub use std::io::{Seek, SeekFrom};
pub use std::iter;
pub use std::iter::repeat_with;
pub use std::marker::PhantomData;
let mut messagefile = tempfile::tempfile().context("tempfile")?;
messagefile.write_all(message.as_bytes()).context("write")?;
messagefile.flush().context("flush")?;
- messagefile.seek(SeekFrom::Start(0)).context("seek")?;
+ messagefile.rewind().context("seek")?;
Ok::<_,AE>(messagefile)
})().context("write email to temporary file.")?;
assert_eq!( got, exp );
assert_eq!( &obuffer, b"xyz\0" );
}
+
+#[ext(pub, name=SeekExt)]
+impl<T: io::Seek> T {
+ #[throws(io::Error)]
+ fn rewind(&mut self) { self.seek(io::SeekFrom::Start(0))? }
+}