Enum icalendar::Trigger

source ·
pub enum Trigger {
    Duration(Duration, Option<Related>),
    DateTime(CalendarDateTime),
}
Expand description

Describes when an alarm is supposed to occure.

RFC 5545, Section 3.8.6.3, see also Alarm Trigger Relationship This property specifies when an alarm will trigger.

Variants§

§

Duration(Duration, Option<Related>)

Duration in relation to either Start or End of the event

§

DateTime(CalendarDateTime)

Absolute DateTime of the Trigger

Implementations§

source§

impl Trigger

source

pub fn after_start(duration: Duration) -> Trigger

assert_eq!(
    Trigger::after_start(Duration::hours(1)),
    Trigger::Duration(Duration::hours(1), Some(Related::Start))
)

please don’t supply negative durations, you’ll just confuse everybody

source

pub fn after_end(duration: Duration) -> Trigger

assert_eq!(
    Trigger::after_end(Duration::hours(1)),
    Trigger::Duration(Duration::hours(1), Some(Related::End))
)

please don’t supply negative durations, you’ll just confuse everybody

source

pub fn before_start(duration: Duration) -> Trigger

assert_eq!(
    Trigger::before_start(Duration::hours(1)),
    Trigger::Duration(-Duration::hours(1), Some(Related::Start))
)

please don’t supply negative durations, you’ll just confuse everybody

source

pub fn before_end(duration: Duration) -> Trigger

assert_eq!(
    Trigger::before_end(Duration::hours(1)),
    Trigger::Duration(-Duration::hours(1), Some(Related::End))
)

please don’t supply negative durations, you’ll just confuse everybody

source

pub fn related(&self) -> Option<Related>

Returns the containing Related if the Trigger contains one

source

pub fn as_duration(&self) -> Option<&Duration>

Returns the containing Duration if the Trigger contains one

source

pub fn as_date_time(&self) -> Option<&CalendarDateTime>

Returns the containing CalendarDateTime if the Trigger contains one

Trait Implementations§

source§

impl Clone for Trigger

source§

fn clone(&self) -> Trigger

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Trigger

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<(TimeDelta, Related)> for Trigger

source§

fn from((duration, related): (Duration, Related)) -> Self

Converts to this type from the input type.
source§

impl<T> From<T> for Trigger

source§

fn from(dt: T) -> Self

Converts to this type from the input type.
source§

impl From<TimeDelta> for Trigger

source§

fn from(duration: Duration) -> Self

Converts to this type from the input type.
source§

impl From<Trigger> for Property

source§

fn from(trigger: Trigger) -> Self

Converts to this type from the input type.
source§

impl PartialEq for Trigger

source§

fn eq(&self, other: &Trigger) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl TryFrom<&Property> for Trigger

§

type Error = ()

The type returned in the event of a conversion error.
source§

fn try_from(prop: &Property) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Eq for Trigger

source§

impl StructuralPartialEq for Trigger

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.