pub struct TestEvents<E: Iterator<Item = KeyEvent>> { /* private fields */ }Expand description
A simple wrapper around a KeyEvent iterator that can be used in tests.
Even though EventIterator expects the iterator to be infinite, only having enough events to
complete the test is necessary.
It will also check that the internal iterator is fully exhausted on Drop.
§Panics
It will panic if the events run out next_event is called, or if there are events remaining
when dropped.
Implementations§
Source§impl<E: Iterator<Item = KeyEvent>> TestEvents<E>
impl<E: Iterator<Item = KeyEvent>> TestEvents<E>
Sourcepub fn new<I: IntoIterator<IntoIter = E, Item = KeyEvent>>(iter: I) -> Self
pub fn new<I: IntoIterator<IntoIter = E, Item = KeyEvent>>(iter: I) -> Self
Create a new TestEvents
Trait Implementations§
Source§impl<E: Clone + Iterator<Item = KeyEvent>> Clone for TestEvents<E>
impl<E: Clone + Iterator<Item = KeyEvent>> Clone for TestEvents<E>
Source§fn clone(&self) -> TestEvents<E>
fn clone(&self) -> TestEvents<E>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<E: Iterator<Item = KeyEvent>> EventIterator for TestEvents<E>
impl<E: Iterator<Item = KeyEvent>> EventIterator for TestEvents<E>
Source§fn next_event(&mut self) -> Result<KeyEvent>
fn next_event(&mut self) -> Result<KeyEvent>
Get the next event
Auto Trait Implementations§
impl<E> Freeze for TestEvents<E>where
E: Freeze,
impl<E> RefUnwindSafe for TestEvents<E>where
E: RefUnwindSafe,
impl<E> Send for TestEvents<E>where
E: Send,
impl<E> Sync for TestEvents<E>where
E: Sync,
impl<E> Unpin for TestEvents<E>where
E: Unpin,
impl<E> UnwindSafe for TestEvents<E>where
E: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more