File tree Expand file tree Collapse file tree 1 file changed +0
-33
lines changed
Expand file tree Collapse file tree 1 file changed +0
-33
lines changed Original file line number Diff line number Diff 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
11380impl FrameProvider {
You can’t perform that action at this time.
0 commit comments