fn email_result(&self, count: std::result::Result<i32, String>, recipient: &str) -> std::io::Result<String> {
        let email_message = match count {
            Ok(n) if n == 0 => format!("Unfortunately, there are still no slots open for course {}.\
                                       \nCourse URL: {}",
                                       self.course_id,
                                       &self.url),
            Ok(n) if n == 1 => format!("Hurry! There's an open spot available for course {}.\
                                       \nCourse URL: {}",
                                       self.course_id,
                                       &self.url),
            Ok(n) => format!("Congrats! There are {} open spots for course {}.\nCourse URL: {}",
                             n,
                             self.course_id,
                             &self.url),
            Err(mes) => format!("Something went wrong when looking at open seats for course {}.\
                                Failed with output `{}`.\nCourse URL: {}",
                                mes,
                                self.course_id,
                                &self.url)
        };
        cmd!("echo", email_message)
            .pipe(cmd!("msmtp", "-a", "default", recipient))
            .read()
    }
// Parses the result from check_open_seats, and sends an email about it
Parses the result from check_open_seats, and sends an email about it
Parses the result from check_open_seats and sends an email about it
fn email_result(&self, count: std::result::Result<i32, String>, recipient: &str) -> std::io::Result<String> {
        let email_message = match count {
            Ok(n) if n == 0 => format!("Unfortunately, there are still no slots open for course {}.\
                                       \nCourse URL: {}",
                                       self.course_id,
                                       &self.url),
            Ok(n) if n == 1 => format!("Hurry! There's an open spot available for course {}.\
                                       \nCourse URL: {}",
                                       self.course_id,
                                       &self.url),
            Ok(n) => format!("Congrats! There are {} open spots for course {}.\nCourse URL: {}",
                             n,
                             self.course_id,
                             &self.url),
            Err(mes) => format!("Something went wrong when looking at open seats for course {}.\
                                Failed with output `{}`.\nCourse URL: {}",
                                mes,
                                self.course_id,
                                &self.url)
        };
        cmd!("echo", email_message)
            .pipe(cmd!("msmtp", "-a", "default", recipient))
            .read()
    }
fn email_result ( & self , count : std :: result :: Result < i32 , String > , recipient : & str ) -> std :: io :: Result < String > { let email_message = match count { Ok ( n ) if n == 0 => format ! ( " \
 \n " self course_id self url ) , Ok ( n ) if n == 1 => format ! ( " \
 \n " self course_id self url ) , Ok ( n ) => format ! ( " \n " n self course_id self url ) , Err ( mes ) => format ! ( " \
 \n " mes self course_id self url ) } ; cmd ! ( " " email_message ) . pipe ( cmd ! ( " " " " " " recipient ) ) . read ( ) }
Parses the result from check_open_seats, and sends an email about it
Parses the result from check_open_seats and sends an email about it
&self
count
std::result::Result<i32, String>
recipient
&str