Skip to content

Commit 17e2122

Browse files
authored
Merge pull request #114 from bugadani/buffer
Use buffered writer
2 parents 03b0f18 + 600d187 commit 17e2122

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

espflash/src/connection.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
use std::{io::Write, thread::sleep, time::Duration};
1+
use std::{
2+
io::{BufWriter, Write},
3+
thread::sleep,
4+
time::Duration,
5+
};
26

37
use binread::{io::Cursor, BinRead, BinReaderExt};
48
use bytemuck::{Pod, Zeroable};
@@ -113,7 +117,8 @@ impl Connection {
113117
}
114118

115119
pub fn write_command(&mut self, command: Command) -> Result<(), Error> {
116-
let mut encoder = SlipEncoder::new(&mut self.serial)?;
120+
let mut writer = BufWriter::new(&mut self.serial);
121+
let mut encoder = SlipEncoder::new(&mut writer)?;
117122
command.write(&mut encoder)?;
118123
encoder.finish()?;
119124
Ok(())

0 commit comments

Comments
 (0)