pub struct Alarm { /* private fields */ }
Expand description
VALARM (RFC 5545, Section 3.6.6 )
Alarms can be added to Event
s and Todo
s.
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.
- Display
- Audio
- 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§
Source§impl Alarm
impl Alarm
Sourcepub fn audio<T: Into<Trigger>>(trigger: T) -> Self
pub fn audio<T: Into<Trigger>>(trigger: T) -> Self
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
Sourcepub fn display(description: &str, trigger: impl Into<Trigger>) -> Self
pub fn display(description: &str, trigger: impl Into<Trigger>) -> Self
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
Trait Implementations§
Source§impl Component for Alarm
impl Component for Alarm
Source§fn component_kind(&self) -> String
fn component_kind(&self) -> String
Source§fn components(&self) -> &[Other]
fn components(&self) -> &[Other]
Read-only access to properties
Source§fn multi_properties(&self) -> &BTreeMap<String, Vec<Property>>
fn multi_properties(&self) -> &BTreeMap<String, Vec<Property>>
Read-only access to multi_properties
Source§fn append_multi_property(&mut self, property: impl Into<Property>) -> &mut Self
fn append_multi_property(&mut self, property: impl Into<Property>) -> &mut Self
Adds a Property
of which there may be many
Source§fn append_component(&mut self, child: impl Into<Other>) -> &mut Self
fn append_component(&mut self, child: impl Into<Other>) -> &mut Self
Component
Source§fn try_into_string(&self) -> Result<String, Error>
fn try_into_string(&self) -> Result<String, Error>
rfc5545
againSource§fn add_property(
&mut self,
key: impl Into<String>,
val: impl Into<String>,
) -> &mut Self
fn add_property( &mut self, key: impl Into<String>, val: impl Into<String>, ) -> &mut Self
Property
Source§fn add_property_pre_alloc(&mut self, key: String, val: String) -> &mut Self
fn add_property_pre_alloc(&mut self, key: String, val: String) -> &mut Self
Property
Source§fn add_multi_property(&mut self, key: &str, val: &str) -> &mut Self
fn add_multi_property(&mut self, key: &str, val: &str) -> &mut Self
Property
Source§fn get_summary(&self) -> Option<&str>
fn get_summary(&self) -> Option<&str>
Source§fn description(&mut self, desc: &str) -> &mut Self
fn description(&mut self, desc: &str) -> &mut Self
Source§fn get_description(&self) -> Option<&str>
fn get_description(&self) -> Option<&str>
Source§fn get_sequence(&self) -> Option<u32>
fn get_sequence(&self) -> Option<u32>
Source§fn last_modified(&mut self, dt: DateTime<Utc>) -> &mut Self
fn last_modified(&mut self, dt: DateTime<Utc>) -> &mut Self
Source§fn get_last_modified(&self) -> Option<DateTime<Utc>>
fn get_last_modified(&self) -> Option<DateTime<Utc>>
LAST_MODIFIED
property.