Struct icalendar::Alarm

source ·
pub struct Alarm { /* private fields */ }
Expand description

VALARM (RFC 5545, Section 3.6.6 )

Alarms can be added to Events and Todos. An alarm always has a Trigger and an Action. The Trigger describes when the alarm should happen and the Action describes what should happen.

Triggers

An alarm can either be triggered at an absolute time or in relation to its event, so the Trigger can either be an absolute CalendarDateTime or a Duration plus a relation tag, which defines wether the duration is related to the events start or end.

Action

When it is time for the Alarm to occur we have to define what is actually supposed to happen. The RFC5545 know three different actions, two of which are currently implemented.

  1. Display
  2. Audio
  3. Email (not yet implemented)

 // alarm will occur one minute from now
 let event_with_absolute_audio_alarm = Event::new()
     .alarm(
         Alarm::audio(Utc::now() + Duration::minutes(1))
         .duration_and_repeat(Duration::minutes(1), 4)
     )
     .done();

 // alarm will occur one minute before the start
 let event_with_relative_display_alarm = Event::new()
     .alarm(
         Alarm::display("ALARM! ALARM!", -Duration::minutes(1))
         .duration_and_repeat(Duration::minutes(1), 4)
     )
     .done();

 // alarm will occur one minute before the end
 let event_with_relative_display_alarm_end = Event::new()
     .alarm(
         Alarm::display("ALARM! ALARM!", (-Duration::minutes(1), Related::End))
         .duration_and_repeat(Duration::minutes(1), 4)
     )
     .done();

Implementations§

Creates a new Audio- Alarm Component

Definition

‘action’ and ‘trigger’ are both REQUIRED, but MUST NOT occur more than once.

action / trigger /

‘duration’ and ‘repeat’ are both OPTIONAL, and MUST NOT occur more than once each; but if one occurs, so MUST the other.

duration / repeat /

The following is OPTIONAL, but MUST NOT occur more than once.

attach /

The following is OPTIONAL, and MAY occur more than once.

x-prop / iana-prop

Creates a new Display- Alarm Component

Definition

The following are REQUIRED, but MUST NOT occur more than once.

action / description / trigger /

‘duration’ and ‘repeat’ are both OPTIONAL, and MUST NOT occur more than once each; but if one occurs, so MUST the other.

duration / repeat /

The following is OPTIONAL, and MAY occur more than once.

x-prop / iana-prop

Sets duration the REPEAT and DURATION property, which must not occur independent from one another

End of builder pattern. copies over everything

Trait Implementations§

Tells you what kind of Component this is

Might be VEVENT, VTODO, VALARM etc

Read-only access to properties

Read-only access to properties

Read-only access to multi_properties

Adds a Property

Adds a Property of which there may be many

Append a given Component
Gets the value of a property.
Writes Component using std::fmt.
Serializes this component into rfc5545 again Read more
Serializes this component into rfc5545 again
Construct and append a Property
Construct and append a Property
Construct and append a Property
Gets the DTSTAMP property.
Gets the DTSTART Property
Gets the DTEND Property
Defines the relative priority. Read more
Gets the relative priority. Read more
Prints to stdout
Set the summary
Gets the summary
Set the description
Gets the description
Set the UID
Gets the UID
Set the sequence
Gets the SEQUENCE
Set the visibility class
Gets the visibility class
Sets the URL.
Gets the URL.
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
The type returned in the event of a conversion error.
Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.