Struct rrule::RRuleProperties
source · [−]pub struct RRuleProperties {Show 16 fields
pub freq: Frequency,
pub interval: u16,
pub count: Option<u32>,
pub until: Option<DateTime<Tz>>,
pub week_start: Weekday,
pub by_set_pos: Vec<i32>,
pub by_month: Vec<u8>,
pub by_month_day: Vec<i8>,
pub by_n_month_day: Vec<i8>,
pub by_year_day: Vec<i16>,
pub by_week_no: Vec<i8>,
pub by_weekday: Vec<NWeekday>,
pub by_hour: Vec<u8>,
pub by_minute: Vec<u8>,
pub by_second: Vec<u8>,
pub by_easter: Option<i16>,
}
Fields
freq: Frequency
The frequency of the rule. For example: yearly, weekly, hourly
interval: u16
The interval between each frequency iteration. For example:
- A yearly frequency with an interval of
2
creates 1 event every two years. - An hourly frequency with an interval of
2
created 1 event every two hours.
count: Option<u32>
How many occurrences will be generated.
until: Option<DateTime<Tz>>
The end date after which new events will no longer be generated.
If the DateTime
is equal to an instance of the event it will be the last event.
week_start: Weekday
The start day of the week. This will affect recurrences based on weekly periods.
by_set_pos: Vec<i32>
Occurrence number corresponding to the frequency period. For example:
- A monthly frequency with an
by_set_pos
of-1
meaning the last day of the month. - An hourly frequency with an
by_set_pos
of2
meaning the 2nd hour. (TODO Check)
by_month: Vec<u8>
The months to apply the recurrence to. Can be a value from 1 to 12.
by_month_day: Vec<i8>
The month days to apply the recurrence to. Can be a value from -31 to -1 and 1 to 31.
by_n_month_day: Vec<i8>
by_year_day: Vec<i16>
The year days to apply the recurrence to. Can be a value from -366 to -1 and 1 to 366.
by_week_no: Vec<i8>
The week numbers to apply the recurrence to.
Week numbers have the meaning described in ISO8601, that is,
the first week of the year is that containing at least four days of the new year.
Week day starts counting on from week_start
value.
Can be a value from -53 to -1 and 1 to 53.
by_weekday: Vec<NWeekday>
The days of the week the rules should be recurring.
Should be a value of Weekday
and optionally with a prefix of -366 to 366 depending on frequency.
Corresponds with BYDAY
field.
by_hour: Vec<u8>
The hours to apply the recurrence to. Can be a value from 0 to 23.
by_minute: Vec<u8>
The minutes to apply the recurrence to. Can be a value from 0 to 59.
by_second: Vec<u8>
The seconds to apply the recurrence to. Can be a value from 0 to 59.
by_easter: Option<i16>
Extension, not part of RFC spec.
Amount of days/months from Easter Sunday itself.
Can be a value from -366 to 366.
Note: Only used when by-easter
feature flag is set. Otherwise, it is ignored.
Implementations
sourceimpl RRuleProperties
impl RRuleProperties
pub fn new(freq: Frequency) -> Self
sourcepub fn freq(self, freq: Frequency) -> Self
pub fn freq(self, freq: Frequency) -> Self
The FREQ rule part identifies the type of recurrence rule.
sourcepub fn count(self, count: u32) -> Self
pub fn count(self, count: u32) -> Self
If given, this determines how many occurrences will be generated.
sourcepub fn until(self, until: DateTime<Utc>) -> Self
pub fn until(self, until: DateTime<Utc>) -> Self
If given, this must be a datetime instance specifying the upper-bound limit of the recurrence.
sourcepub fn week_start(self, week_start: Weekday) -> Self
pub fn week_start(self, week_start: Weekday) -> Self
The week start day. This will affect recurrences based on weekly periods.
The default week start is Weekday::Mon
.
sourcepub fn by_set_pos(self, by_set_pos: Vec<i32>) -> Self
pub fn by_set_pos(self, by_set_pos: Vec<i32>) -> Self
If given, it must be either an integer, or a sequence of integers, positive or negative. Each given integer will specify an occurrence number, corresponding to the nth occurrence of the rule inside the frequency period. For example, a by_set_pos of -1 if combined with a MONTHLY frequency, and a by_weekday of (MO, TU, WE, TH, FR), will result in the last work day of every month.
sourcepub fn by_month(self, by_month: Vec<Month>) -> Self
pub fn by_month(self, by_month: Vec<Month>) -> Self
If given, it must be either an integer, or a sequence of integers, meaning the months to apply the recurrence to.
sourcepub fn by_month_day(self, by_month_day: Vec<i8>) -> Self
pub fn by_month_day(self, by_month_day: Vec<i8>) -> Self
If given, it must be either an integer, or a sequence of integers, meaning the month days to apply the recurrence to.
sourcepub fn by_year_day(self, by_year_day: Vec<i16>) -> Self
pub fn by_year_day(self, by_year_day: Vec<i16>) -> Self
If given, it must be either an integer, or a sequence of integers, meaning the year days to apply the recurrence to.
sourcepub fn by_week_no(self, by_week_no: Vec<i8>) -> Self
pub fn by_week_no(self, by_week_no: Vec<i8>) -> Self
If given, it must be either an integer, or a sequence of integers, meaning the week numbers to apply the recurrence to. Week numbers have the meaning described in ISO8601, that is, the first week of the year is that containing at least four days of the new year.
sourcepub fn by_weekday(self, by_weekday: Vec<NWeekday>) -> Self
pub fn by_weekday(self, by_weekday: Vec<NWeekday>) -> Self
If given, it must be either an integer (0 == MO), a sequence of integers, one of the weekday constants (MO, TU, etc.), or a sequence of these constants. When given, these variables will define the weekdays where the recurrence will be applied. A nth occurrence prefix can be given.
sourcepub fn by_hour(self, by_hour: Vec<u8>) -> Self
pub fn by_hour(self, by_hour: Vec<u8>) -> Self
If given, it must be either an integer, or a sequence of integers, meaning the hours to apply the recurrence to.
sourcepub fn by_minute(self, by_minute: Vec<u8>) -> Self
pub fn by_minute(self, by_minute: Vec<u8>) -> Self
If given, it must be either an integer, or a sequence of integers, meaning the minutes to apply the recurrence to.
Trait Implementations
sourceimpl Clone for RRuleProperties
impl Clone for RRuleProperties
sourcefn clone(&self) -> RRuleProperties
fn clone(&self) -> RRuleProperties
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for RRuleProperties
impl Debug for RRuleProperties
sourceimpl Default for RRuleProperties
impl Default for RRuleProperties
sourceimpl Display for RRuleProperties
impl Display for RRuleProperties
sourcefn fmt(&self, f: &mut Formatter<'_>) -> Result
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Generates a string based on the iCalendar RRULE spec. It doesn’t prepend “RRULE:” to the string. This function doesn’t validate the existing object and may generate an invalid string like ‘FREQ=YEARLY;INTERVAL=-1’
sourceimpl FromStr for RRuleProperties
impl FromStr for RRuleProperties
sourceimpl PartialEq<RRuleProperties> for RRuleProperties
impl PartialEq<RRuleProperties> for RRuleProperties
sourcefn eq(&self, other: &RRuleProperties) -> bool
fn eq(&self, other: &RRuleProperties) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &RRuleProperties) -> bool
fn ne(&self, other: &RRuleProperties) -> bool
This method tests for !=
.
impl Eq for RRuleProperties
impl StructuralEq for RRuleProperties
impl StructuralPartialEq for RRuleProperties
Auto Trait Implementations
impl RefUnwindSafe for RRuleProperties
impl Send for RRuleProperties
impl Sync for RRuleProperties
impl Unpin for RRuleProperties
impl UnwindSafe for RRuleProperties
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more