File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -98,27 +98,21 @@ impl From<SndioError> for SupportedStreamConfigsError {
9898 }
9999}
100100
101- pub struct Devices {
102- returned : bool ,
101+ pub struct Devices ( Option < Device > ) ;
102+
103+ impl Devices {
104+ fn new ( ) -> Self {
105+ Devices ( Some ( Device :: new ( ) ) )
106+ }
103107}
104108
105109impl Iterator for Devices {
106110 type Item = Device ;
107- fn next ( & mut self ) -> Option < Device > {
108- if self . returned {
109- None
110- } else {
111- self . returned = true ;
112- Some ( Device :: new ( ) )
113- }
111+ fn next ( & mut self ) -> Option < Self :: Item > {
112+ self . 0 . take ( )
114113 }
115114}
116115
117- impl Devices {
118- fn new ( ) -> Devices {
119- Devices { returned : false }
120- }
121- }
122116
123117/// The shared state between Device and Stream. Responsible for closing handle when dropped.
124118struct InnerState {
You can’t perform that action at this time.
0 commit comments