File tree Expand file tree Collapse file tree 1 file changed +8
-14
lines changed Expand file tree Collapse file tree 1 file changed +8
-14
lines changed Original file line number Diff line number Diff line change @@ -98,27 +98,21 @@ impl From<SndioError> for SupportedStreamConfigsError {
98
98
}
99
99
}
100
100
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
+ }
103
107
}
104
108
105
109
impl Iterator for Devices {
106
110
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 ( )
114
113
}
115
114
}
116
115
117
- impl Devices {
118
- fn new ( ) -> Devices {
119
- Devices { returned : false }
120
- }
121
- }
122
116
123
117
/// The shared state between Device and Stream. Responsible for closing handle when dropped.
124
118
struct InnerState {
You can’t perform that action at this time.
0 commit comments