Struct rrule::RRuleSet

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

A validated Recurrence Rule that can be used to create an iterator.

Implementations§

source§

impl RRuleSet

source

pub fn new(dt_start: DateTime<Tz>) -> Self

Creates an empty RRuleSet, starting from ds_start.

source

pub fn limit(self) -> Self

Enable validation limits.

This is only needed if you are going to use the Iterator api directly.

source

pub fn before(self, dt: DateTime<Tz>) -> Self

Only return recurrences that comes before this DateTime.

This value will not be used if you use the Iterator API directly.

source

pub fn after(self, dt: DateTime<Tz>) -> Self

Only return recurrences that comes after this DateTime.

This value will not be used if you use the Iterator API directly.

source

pub fn rrule(self, rrule: RRule) -> Self

Adds a new rrule to the set.

source

pub fn rdate(self, rdate: DateTime<Tz>) -> Self

Adds a new rdate to the set.

source

pub fn exdate(self, exdate: DateTime<Tz>) -> Self

Adds a new exdate to the set.

source

pub fn set_rrules(self, rrules: Vec<RRule>) -> Self

Sets the rrules of the set.

source

pub fn set_rdates(self, rdates: Vec<DateTime<Tz>>) -> Self

Sets the rdates of the set.

source

pub fn set_exdates(self, exdates: Vec<DateTime<Tz>>) -> Self

Set the exdates of the set.

source

pub fn get_rrule(&self) -> &Vec<RRule>

Returns the rrules of the set.

source

pub fn get_exrule(&self) -> &Vec<RRule>

Returns the exrules of the set.

source

pub fn get_rdate(&self) -> &Vec<DateTime<Tz>>

Returns the rdates of the set.

source

pub fn get_exdate(&self) -> &Vec<DateTime<Tz>>

Returns the exdates of the set.

source

pub fn get_dt_start(&self) -> &DateTime<Tz>

Returns the start datetime of the recurring event.

source

pub fn all(self, limit: u16) -> RRuleResult

Returns all the recurrences of the rrule.

Limit must be set in order to prevent infinite loops. The max limit is 65535. If you need more please use into_iter directly.

§Usage
use rrule::RRuleSet;

let rrule_set: RRuleSet = "DTSTART:20210101T090000Z\nRRULE:FREQ=DAILY".parse().unwrap();

// Limit the results to 2 recurrences
let result = rrule_set.all(2);
assert_eq!(result.dates.len(), 2);
assert_eq!(result.limited, true);
source

pub fn all_unchecked(self) -> Vec<DateTime<Tz>>

Returns all the recurrences of the rrule.

§Note

This method does not enforce any validation limits and might lead to very long iteration times. Please read the SECURITY.md for more information.

source

pub fn set_from_string(self, s: &str) -> Result<Self, RRuleError>

Set the RRuleSet properties from a string. If a DTSTART is found, it will be used as the start datetime.

Trait Implementations§

source§

impl Clone for RRuleSet

source§

fn clone(&self) -> RRuleSet

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 RRuleSet

source§

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

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

impl Display for RRuleSet

source§

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

Prints a valid set of iCalendar properties which can be used to create a new RRuleSet later. You may use the generated string to create a new iCalendar component, like VEVENT.

source§

impl FromStr for RRuleSet

source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Creates an RRuleSet from a string if input is valid.

§Errors

Returns RRuleError, if iCalendar string contains invalid parts.

§

type Err = RRuleError

The associated error which can be returned from parsing.
source§

impl<'a> IntoIterator for &'a RRuleSet

§

type Item = DateTime<Tz>

The type of the elements being iterated over.
§

type IntoIter = RRuleSetIter<'a>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl PartialEq for RRuleSet

source§

fn eq(&self, other: &RRuleSet) -> 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 Eq for RRuleSet

source§

impl StructuralPartialEq for RRuleSet

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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. 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.