Skip to main content

Calendar

Struct Calendar 

Source
pub struct Calendar { /* private fields */ }

Implementations§

Source§

impl Calendar

Source

pub fn create( path: &Path, config: Option<CalendarConfig>, ) -> Result<Self, CalendarError>

Create new calendar

Source

pub fn load(path: &Path) -> Result<Self, CalendarError>

Load existing calendar

Source

pub fn path(&self) -> &Path

Source

pub fn config_path(&self) -> PathBuf

Source

pub fn state(&self) -> &CalendarState

Source

pub fn slug(&self) -> Option<&str>

Source

pub fn events(&self) -> Result<Vec<CalendarEvent>, CalendarError>

Load all events in calendar

Source

pub fn event(&self, event_slug: &str) -> Result<CalendarEvent, CalendarError>

Load specific event in calendar

Source

pub fn event_by_instance_id( &self, id: &EventInstanceId, ) -> Result<Option<CalendarEvent>, CalendarError>

Source

pub fn master_event_for( &self, uid: &str, ) -> Result<Option<Event>, CalendarError>

Find the master event of a recurring series given its uid. i.e. a master event is one whose recurrence field is set. Instance overrides (with recurrence_id set) are not considered masters.

Source

pub fn is_read_only(&self) -> bool

Source

pub fn name(&self) -> Option<&str>

Source

pub fn color(&self) -> Option<&str>

Source

pub fn read_only_setting(&self) -> Option<bool>

Source

pub fn split_recurring_series_at( &self, master_uid: &EventUid, split_start: EventTime, split_end: EventTime, new_recurrence: Option<Recurrence>, ) -> Result<Event, CalendarError>

Split a recurring series at split_start:

Original master:

  1. RRULE is truncated to end strictly before split_start
  2. Any EXDATEs at or after split_start are dropped
  3. Any override files at or after split_start are deleted

New master:

  1. Starts at split_start
  2. Inherit all other metadata (summary, description, location etc) from original
  3. Gets a fresh UID and a reset SEQUENCE
Source

pub fn delete_recurring_instance( &self, id: &EventInstanceId, ) -> Result<(), CalendarError>

Exclude a single occurrence from a recurring series i.e. “delete this instance only”

Source

pub fn update_recurring_instance( &self, id: &EventInstanceId, apply: impl FnOnce(&mut Event), ) -> Result<CalendarEvent, CalendarError>

Override a single occurrence of a recurring series

Source

pub fn expanded_events_in_range( &self, from: DateTime<Utc>, to: DateTime<Utc>, ) -> Result<Vec<Event>, CalendarError>

List all events occurring within time range

Source

pub fn create_event(&self, event: Event) -> Result<CalendarEvent, CalendarError>

Create new event in calendar

Source

pub fn delete_event(&self, event_slug: &str) -> Result<(), CalendarError>

Delete event from calendar

Source

pub fn remote_config(&self) -> Option<&RemoteConfig>

Source

pub fn has_remote(&self) -> bool

Source

pub fn config(&self) -> Option<&CalendarConfig>

Source

pub fn remote_email(&self) -> Option<&str>

Source

pub fn base_slug_for(name: Option<&str>) -> String

Trait Implementations§

Source§

impl Debug for Calendar

Source§

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

Formats the value using the given formatter. Read more

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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.