fn read_files(options: Arc<Options>, out_channel: SyncSender<String>) {
    for file in options.files.iter() {
        // First, we open the file, ignoring any errors.
        let file = fs::File::open(file).unwrap();
        // Then we obtain a `BufReader` for it, which provides the `lines` function.
        let file = io::BufReader::new(file);
        for line in file.lines() {
            let line = line.unwrap();
            // Now we send the line over the channel, ignoring the possibility of `send` failing.
            out_channel.send(line).unwrap();
        }
    }
    // When we drop the `out_channel`, it will be closed, which the other end can notice.
}
// The first function reads the files, and sends every line over the `out_channel`.
The first function reads the files, and sends every line over the `out_channel`.
The first function reads the files and sends every line over the ` out_channel ` .
fn read_files(options: Arc<Options>, out_channel: SyncSender<String>) {
    for file in options.files.iter() {
        // First, we open the file, ignoring any errors.
        let file = fs::File::open(file).unwrap();
        // Then we obtain a `BufReader` for it, which provides the `lines` function.
        let file = io::BufReader::new(file);
        for line in file.lines() {
            let line = line.unwrap();
            // Now we send the line over the channel, ignoring the possibility of `send` failing.
            out_channel.send(line).unwrap();
        }
    }
    // When we drop the `out_channel`, it will be closed, which the other end can notice.
}
fn read_files ( options : Arc < Options > , out_channel : SyncSender < String > ) { for file in options . files . iter ( ) { // First, we open the file, ignoring any errors. let file = fs :: File :: open ( file ) . unwrap ( ) ; // Then we obtain a `BufReader` for it, which provides the `lines` function. let file = io :: BufReader :: new ( file ) ; for line in file . lines ( ) { let line = line . unwrap ( ) ; // Now we send the line over the channel, ignoring the possibility of `send` failing. out_channel . send ( line ) . unwrap ( ) ; } } // When we drop the `out_channel`, it will be closed, which the other end can notice. }
The first function reads the files, and sends every line over the `out_channel`.
The first function reads the files and sends every line over the ` out_channel ` .
options
Arc<Options>
out_channel
SyncSender<String>
options
Arc<Options>
out_channel
SyncSender<String>