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 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 get_last_modified(&self) -> Option<DateTime<Utc>>
fn get_last_modified(&self) -> Option<DateTime<Utc>>
LAST_MODIFIED
property.source§impl PartialEq for Alarm
impl PartialEq for Alarm
impl Eq for Alarm
impl StructuralPartialEq for Alarm
Auto Trait Implementations§
impl Freeze for Alarm
impl RefUnwindSafe for Alarm
impl Send for Alarm
impl Sync for Alarm
impl Unpin for Alarm
impl UnwindSafe for Alarm
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)