We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 67fe65a commit 8d6e993Copy full SHA for 8d6e993
src/slip.rs
@@ -5,7 +5,8 @@ const ESC: u8 = 0xDB;
5
const ESC_END: u8 = 0xDC;
6
const ESC_ESC: u8 = 0xDD;
7
8
-pub fn encode_frame(buf: &[u8], mut writer: impl Write) -> io::Result<()> {
+pub fn encode_frame(buf: &[u8], writer: impl Write) -> io::Result<()> {
9
+ let mut writer = std::io::BufWriter::new(writer);
10
for &byte in buf {
11
match byte {
12
END => writer.write_all(&[ESC, ESC_END])?,
@@ -15,6 +16,7 @@ pub fn encode_frame(buf: &[u8], mut writer: impl Write) -> io::Result<()> {
15
16
}
17
18
writer.write_all(&[END])?;
19
+ writer.flush()?;
20
21
Ok(())
22
0 commit comments