io: make with_input provide mut Read

Summary: Without `mut`, the `Read` cannot actually read anything.

Reviewed By: yancouto

Differential Revision: D31465817

fbshipit-source-id: b069499ff0e8a371f0e27402baedfb25414e29a1
This commit is contained in:
Jun Wu 2021-10-13 13:25:05 -07:00 committed by Facebook GitHub Bot
parent 0e8d76b982
commit 17fef63dbc

View File

@ -197,8 +197,8 @@ impl IOProgress {
}
impl IO {
pub fn with_input<R>(&self, f: impl FnOnce(&dyn Read) -> R) -> R {
f(self.inner.lock().input.as_ref())
pub fn with_input<R>(&self, f: impl FnOnce(&mut dyn Read) -> R) -> R {
f(self.inner.lock().input.as_mut())
}
pub fn with_output<R>(&self, f: impl FnOnce(&dyn Write) -> R) -> R {