[][src]Struct web_ical::Calendar

pub struct Calendar {
    pub prodid: String,
    pub version: String,
    pub calscale: String,
    pub method: String,
    pub x_wr_calname: String,
    pub x_wr_timezone: String,
    pub events: Vec<Events>,
}

store the iCalendar and add events from struct Events.

Fields

prodid: Stringversion: Stringcalscale: Stringmethod: Stringx_wr_calname: Stringx_wr_timezone: Stringevents: Vec<Events>

Methods

impl Calendar[src]

pub fn new(url: &'static str) -> Calendar[src]

Request HTTP or HTTPS to iCalendar url.

pub fn create(
    prodid: &'static str,
    version: &'static str,
    calscale: &'static str,
    method: &'static str,
    x_wr_calname: &'static str,
    x_wr_timezone: &'static str
) -> Calendar
[src]

Create your own iCalendar instance

Create an iCalendar

let mut ical =  Calendar::create(
                      "-//My Business Inc//My Calendar 70.9054//EN",
                      "2.0",
                      "GREGORIAN",
                      "PUBLISH",
                      "example@gmail.com",
                      "America/New_York");

pub fn add_event(&mut self, event: Events)[src]

Add events to the calendar.

Add events

let mut start_cal:  DateTime<Utc> = Utc::now();
let start = date_tz.checked_add_signed(Duration::days(2));
  
match start {
      Some(x) => {
             start_cal = x;
      },
      None => ()
}
let own_event = Events{ 
                   
                   dtsart:         start_cal,
                   dtend:          start_cal,
                   dtstamp:        date_tz,
                   uid:            "786566jhjh5546@google.com".to_string(),
                   created:        date_tz,
                   description:    "The description".to_string(),
                   last_modified:  date_tz,
                   location:       "Homestead FL".to_string(),
                   sequence:       0,
                   status:         "CONFIRMED".to_string(),
                   summary:        "My business (Not available)".to_string(),
                   transp:         "OPAQUE".to_string()
                   
   };
let mut ical =  Calendar::create(
                      "-//My Business Inc//My Calendar 70.9054//EN",
                      "2.0",
                      "GREGORIAN",
                      "PUBLISH",
                      "example@gmail.com",
                      "America/New_York");

ical.add_event(own_event);
println!("{}", ical.events[0].summary);

pub fn export_ics(&self, path: &str) -> Result<bool>[src]

Export iCalendar to a file.

iCalendar to a file

 match ical.export_ics("ical.ics"){
       Ok(_) => println!("OK"),
       Err(_) => panic!("Err")
   };

Trait Implementations

impl Clone for Calendar[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]