Skip to content

Commit 1b4e2d3

Browse files
committed
Delete unnecessary try_fetch_frame function
1 parent 30f6501 commit 1b4e2d3

File tree

1 file changed

+0
-33
lines changed

1 file changed

+0
-33
lines changed

src/stream.rs

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -75,39 +75,6 @@ impl FrameProvider {
7575
stream: self.stream.clone(),
7676
})
7777
}
78-
79-
/// Same as [`fetch_frame`](FrameProvider::fetch_frame) but non-blocking.
80-
///
81-
/// Return [`io::ErrorKind::WouldBlock`] if the call cannot be completed without blocking.
82-
pub fn try_fetch_frame(&mut self) -> io::Result<Frame> {
83-
let mut guard = self.stream.try_lock().map_err(|_| {
84-
std::io::Error::new(io::ErrorKind::WouldBlock, "Could not acquire the lock")
85-
})?;
86-
87-
if guard.0 == 0 {
88-
return Err(io::Error::new(
89-
io::ErrorKind::WouldBlock,
90-
"All buffers are currently in use",
91-
));
92-
}
93-
94-
if guard.1.will_block()? {
95-
return Err(io::Error::new(
96-
io::ErrorKind::WouldBlock,
97-
"No new frame available",
98-
));
99-
}
100-
101-
let (index, buffer) = guard.1.dequeue_buf()?;
102-
let buffer = buffer.clone();
103-
guard.0 -= 1;
104-
105-
Ok(Frame {
106-
index,
107-
buffer,
108-
stream: self.stream.clone(),
109-
})
110-
}
11178
}
11279

11380
impl FrameProvider {

0 commit comments

Comments
 (0)