pub fn export_ics(&self, path: &str) -> io::Result<(bool)> {
        let mut data = "BEGIN:VCALENDAR\r\n".to_string();
        let path = Path::new(path);
        let mut f = File::create(&path)?;
        data.push_str("PRODID:");
        data.push_str(&self.prodid);
        data.push_str("\r\n");
        data.push_str("CALSCALE:");
        data.push_str(&self.calscale);
        data.push_str("\r\n");
        data.push_str("VERSION:");
        data.push_str(&self.version);
        data.push_str("\r\n");
        data.push_str("METHOD:");
        data.push_str(&self.method);
        data.push_str("\r\n");
        data.push_str("X-WR-CALNAME:");
        data.push_str(&self.x_wr_calname);
        data.push_str("\r\n");
        data.push_str("X-WR-TIMEZONE:");
        data.push_str(&self.x_wr_timezone);
        data.push_str("\r\n");
        for i in &self.events {
            data.push_str("BEGIN:VEVENT\r\n");
            data.push_str("DTSTART:");
            data.push_str(&i.dtsart.format("%Y%m%dT%H%M%SZ").to_string());
            data.push_str("\r\n");
            data.push_str("DTEND:");
            data.push_str(&i.dtend.format("%Y%m%dT%H%M%SZ").to_string());
            data.push_str("\r\n");
            data.push_str("DTSTAMP:");
            data.push_str(&i.dtstamp.format("%Y%m%dT%H%M%SZ").to_string());
            data.push_str("\r\n");
            data.push_str("UID:");
            data.push_str(&i.uid);
            data.push_str("\r\n");
            data.push_str("CREATED:");
            data.push_str(&i.created.format("%Y%m%dT%H%M%SZ").to_string());
            data.push_str("\r\n");
            data.push_str("DESCRIPTION:");
            data.push_str(&i.description);
            data.push_str("\r\n");
            data.push_str("LAST-MODIFIED:");
            data.push_str(&i.last_modified.format("%Y%m%dT%H%M%SZ").to_string());
            data.push_str("\r\n");
            data.push_str("LOCATION:");
            data.push_str(&i.location);
            data.push_str("\r\n");
            data.push_str("SEQUENCE:");
            data.push_str(&i.sequence.to_string());
            data.push_str("\r\n");
            data.push_str("STATUS:");
            data.push_str(&i.status);
            data.push_str("\r\n");
            data.push_str("SUMMARY:");
            data.push_str(&i.summary);
            data.push_str("\r\n");
            data.push_str("TRANSP:");
            data.push_str(&i.transp);
            data.push_str("\r\n");
            data.push_str("END:VEVENT\r\n");
        }
        data.push_str("END:VCALENDAR");
        match f.write_all(data.as_bytes()) {
            Ok(_) => Ok(true),
            Err(e) => Err(e),
        }
    }
///Export iCalendar to a file.
///
/// # iCalendar to a file
/// ```
///  match ical.export_ics("ical.ics"){
///        Ok(_) => println!("OK"),
///        Err(_) => panic!("Err")
///    };
/// ```

Export iCalendar to a file.
Export iCalendar to a file .
pub fn export_ics(&self, path: &str) -> io::Result<(bool)> {
        let mut data = "BEGIN:VCALENDAR\r\n".to_string();
        let path = Path::new(path);
        let mut f = File::create(&path)?;
        data.push_str("PRODID:");
        data.push_str(&self.prodid);
        data.push_str("\r\n");
        data.push_str("CALSCALE:");
        data.push_str(&self.calscale);
        data.push_str("\r\n");
        data.push_str("VERSION:");
        data.push_str(&self.version);
        data.push_str("\r\n");
        data.push_str("METHOD:");
        data.push_str(&self.method);
        data.push_str("\r\n");
        data.push_str("X-WR-CALNAME:");
        data.push_str(&self.x_wr_calname);
        data.push_str("\r\n");
        data.push_str("X-WR-TIMEZONE:");
        data.push_str(&self.x_wr_timezone);
        data.push_str("\r\n");
        for i in &self.events {
            data.push_str("BEGIN:VEVENT\r\n");
            data.push_str("DTSTART:");
            data.push_str(&i.dtsart.format("%Y%m%dT%H%M%SZ").to_string());
            data.push_str("\r\n");
            data.push_str("DTEND:");
            data.push_str(&i.dtend.format("%Y%m%dT%H%M%SZ").to_string());
            data.push_str("\r\n");
            data.push_str("DTSTAMP:");
            data.push_str(&i.dtstamp.format("%Y%m%dT%H%M%SZ").to_string());
            data.push_str("\r\n");
            data.push_str("UID:");
            data.push_str(&i.uid);
            data.push_str("\r\n");
            data.push_str("CREATED:");
            data.push_str(&i.created.format("%Y%m%dT%H%M%SZ").to_string());
            data.push_str("\r\n");
            data.push_str("DESCRIPTION:");
            data.push_str(&i.description);
            data.push_str("\r\n");
            data.push_str("LAST-MODIFIED:");
            data.push_str(&i.last_modified.format("%Y%m%dT%H%M%SZ").to_string());
            data.push_str("\r\n");
            data.push_str("LOCATION:");
            data.push_str(&i.location);
            data.push_str("\r\n");
            data.push_str("SEQUENCE:");
            data.push_str(&i.sequence.to_string());
            data.push_str("\r\n");
            data.push_str("STATUS:");
            data.push_str(&i.status);
            data.push_str("\r\n");
            data.push_str("SUMMARY:");
            data.push_str(&i.summary);
            data.push_str("\r\n");
            data.push_str("TRANSP:");
            data.push_str(&i.transp);
            data.push_str("\r\n");
            data.push_str("END:VEVENT\r\n");
        }
        data.push_str("END:VCALENDAR");
        match f.write_all(data.as_bytes()) {
            Ok(_) => Ok(true),
            Err(e) => Err(e),
        }
    }
pub fn export_ics ( & self , path : & str ) -> io :: Result < ( bool ) > { let mut data = " \r \n " . to_string ( ) ; let path = Path :: new ( path ) ; let mut f = File :: create ( & path ) ? ; data . push_str ( " " ) ; data . push_str ( & self . prodid ) ; data . push_str ( " \r \n " ) ; data . push_str ( " " ) ; data . push_str ( & self . calscale ) ; data . push_str ( " \r \n " ) ; data . push_str ( " " ) ; data . push_str ( & self . version ) ; data . push_str ( " \r \n " ) ; data . push_str ( " " ) ; data . push_str ( & self . method ) ; data . push_str ( " \r \n " ) ; data . push_str ( " " ) ; data . push_str ( & self . x_wr_calname ) ; data . push_str ( " \r \n " ) ; data . push_str ( " " ) ; data . push_str ( & self . x_wr_timezone ) ; data . push_str ( " \r \n " ) ; for i in & self . events { data . push_str ( " \r \n " ) ; data . push_str ( " " ) ; data . push_str ( & i . dtsart . format ( " " ) . to_string ( ) ) ; data . push_str ( " \r \n " ) ; data . push_str ( " " ) ; data . push_str ( & i . dtend . format ( " " ) . to_string ( ) ) ; data . push_str ( " \r \n " ) ; data . push_str ( " " ) ; data . push_str ( & i . dtstamp . format ( " " ) . to_string ( ) ) ; data . push_str ( " \r \n " ) ; data . push_str ( " " ) ; data . push_str ( & i . uid ) ; data . push_str ( " \r \n " ) ; data . push_str ( " " ) ; data . push_str ( & i . created . format ( " " ) . to_string ( ) ) ; data . push_str ( " \r \n " ) ; data . push_str ( " " ) ; data . push_str ( & i . description ) ; data . push_str ( " \r \n " ) ; data . push_str ( " " ) ; data . push_str ( & i . last_modified . format ( " " ) . to_string ( ) ) ; data . push_str ( " \r \n " ) ; data . push_str ( " " ) ; data . push_str ( & i . location ) ; data . push_str ( " \r \n " ) ; data . push_str ( " " ) ; data . push_str ( & i . sequence . to_string ( ) ) ; data . push_str ( " \r \n " ) ; data . push_str ( " " ) ; data . push_str ( & i . status ) ; data . push_str ( " \r \n " ) ; data . push_str ( " " ) ; data . push_str ( & i . summary ) ; data . push_str ( " \r \n " ) ; data . push_str ( " " ) ; data . push_str ( & i . transp ) ; data . push_str ( " \r \n " ) ; data . push_str ( " \r \n " ) ; } data . push_str ( " " ) ; match f . write_all ( data . as_bytes ( ) ) { Ok ( _ ) => Ok ( true ) , Err ( e ) => Err ( e ) , } }
Export iCalendar to a file.
Export iCalendar to a file .
&self
path
&str
&self
path
&str
icalendar to a file

None