1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
use super::common::receive_from_stream; use crate::reply::Event; use crate::Fallible; use std::convert::TryFrom; use std::os::unix::net::UnixStream; pub struct EventIterator(pub(crate) UnixStream); impl Iterator for EventIterator { type Item = Fallible<Event>; fn next(&mut self) -> Option<Self::Item> { Some(match receive_from_stream(&mut self.0) { Ok(v) => Event::try_from(v), Err(e) => Err(e), }) } }