fn as_event_stream(
    fs: Arc<Mutex<FileSystem>>,
    event_result: Result<WatchEvent, std::io::Error>,
    event_time: EventTimestamp,
) -> impl Stream<Item = (Result<Event, Error>, EventTimestamp)> {
    match event_result {
        Err(error) => {
            futures::stream::iter(vec![(Err(Error::File(error)), event_time)]).left_stream()
        }
        Ok(event) => {
            let a = match fs
                .try_lock()
                .expect("couldn't lock filesystem cache")
                .process(event)
            {
                Ok(events) => events
                    .into_iter()
                    .map(Ok)
                    .collect::<SmallVec<[Result<Event, Error>; 2]>>(),
                Err(e) => {
                    let mut result: SmallVec<[Result<Event, Error>; 2]> = SmallVec::new();
                    result.push(Err(e));
                    result
                }
            };

            let a = a
                .into_iter()
                .map(move |event_result| (event_result, event_time));

            futures::stream::iter(a).right_stream()
        }
    }
}
/// Turns an inotify event into an event stream
Turns an inotify event into an event stream
Turns an inotify event into an event stream
fn as_event_stream(
    fs: Arc<Mutex<FileSystem>>,
    event_result: Result<WatchEvent, std::io::Error>,
    event_time: EventTimestamp,
) -> impl Stream<Item = (Result<Event, Error>, EventTimestamp)> {
    match event_result {
        Err(error) => {
            futures::stream::iter(vec![(Err(Error::File(error)), event_time)]).left_stream()
        }
        Ok(event) => {
            let a = match fs
                .try_lock()
                .expect("couldn't lock filesystem cache")
                .process(event)
            {
                Ok(events) => events
                    .into_iter()
                    .map(Ok)
                    .collect::<SmallVec<[Result<Event, Error>; 2]>>(),
                Err(e) => {
                    let mut result: SmallVec<[Result<Event, Error>; 2]> = SmallVec::new();
                    result.push(Err(e));
                    result
                }
            };
            let a = a
                .into_iter()
                .map(move |event_result| (event_result, event_time));
            futures::stream::iter(a).right_stream()
        }
    }
}
fn as_event_stream ( fs : Arc < Mutex < FileSystem > > , event_result : Result < WatchEvent , std :: io :: Error > , event_time : EventTimestamp , ) -> impl Stream < Item = ( Result < Event , Error > , EventTimestamp ) > { match event_result { Err ( error ) => { futures :: stream :: iter ( vec ! [ ( Err ( Error File ( error ) ) event_time ) ] ) . left_stream ( ) } Ok ( event ) => { let a = match fs . try_lock ( ) . expect ( " " ) . process ( event ) { Ok ( events ) => events . into_iter ( ) . map ( Ok ) . collect :: < SmallVec < [ Result < Event , Error > ; 2 ] > > ( ) , Err ( e ) => { let mut result : SmallVec < [ Result < Event , Error > ; 2 ] > = SmallVec :: new ( ) ; result . push ( Err ( e ) ) ; result } } ; let a = a . into_iter ( ) . map ( move | event_result | ( event_result , event_time ) ) ; futures :: stream :: iter ( a ) . right_stream ( ) } } }
Turns an inotify event into an event stream
Turns an inotify event into an event stream
fs
Arc<Mutex<FileSystem>>
event_result
Result<WatchEvent, std::io::Error>
event_time
EventTimestamp
fs
Arc<Mutex<FileSystem>>
event_result
Result<WatchEvent, std::io::Error>
event_time
EventTimestamp