chiark
/
gitweb
/
~ianmdlvl
/
otter.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
52ce07b
)
packetframe: Make badeof into a fn rather than a closure
author
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Sat, 17 Apr 2021 19:12:50 +0000
(20:12 +0100)
committer
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Fri, 23 Apr 2021 18:32:07 +0000
(19:32 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/packetframe.rs
patch
|
blob
|
history
diff --git
a/src/packetframe.rs
b/src/packetframe.rs
index c1f9307e4116ef454c5fcfcd3d4c36eddfa830a7..e6587703ecc9d2614537c6405b7a95de171bdb25 100644
(file)
--- a/
src/packetframe.rs
+++ b/
src/packetframe.rs
@@
-154,6
+154,8
@@
impl ReaderState {
}
}
+fn badeof() -> ReadError { RE::IO(io::ErrorKind::UnexpectedEof.into()) }
+
impl<R:Read> FrameReader<R> {
pub fn new(r: R) -> FrameReader<R> where R:BufRead {
Self::new_unbuf(r)
@@
-179,7
+181,6
@@
impl<R:Read> FrameReader<R> {
#[throws(ReadError)]
fn do_read(&mut self, buf: &mut [u8]) -> usize {
- let badeof = || RE::IO(io::ErrorKind::UnexpectedEof.into());
assert_ne!(buf.len(), 0);
let remaining = match self.state {
Idle => panic!(),