Skip to content

Commit 8e88374

Browse files
committed
Implements FusedIterator
1 parent 3c762fb commit 8e88374

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/leds.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use stm32f3xx_hal::gpio::{Output, PushPull};
55
use switch_hal::{ActiveHigh, IntoSwitch, OutputSwitch, Switch};
66

77
use core::slice::Iter;
8+
use core::iter::FusedIterator;
89

910
/// LED compass direction as noted on the board
1011
#[derive(Clone, Copy, Eq, PartialEq)]
@@ -223,6 +224,9 @@ impl<'a> ExactSizeIterator for LedsIterator<'a> {
223224
}
224225
}
225226

227+
///Marker trait that indicates LedsIterator never starts returning Some after returning None
228+
impl<'a> FusedIterator for LedsIterator<'a> {}
229+
226230
pub struct LedsMutIterator<'a> {
227231
current_index: usize,
228232
leds: &'a mut Leds
@@ -276,3 +280,6 @@ impl<'a> ExactSizeIterator for LedsMutIterator<'a> {
276280
ITERATOR_SIZE - self.current_index
277281
}
278282
}
283+
284+
///Marker trait that indicates LedsMutIterator never starts returning Some after returning None
285+
impl<'a> FusedIterator for LedsMutIterator<'a> {}

0 commit comments

Comments
 (0)