Skip to main content

EventsManager

Struct EventsManager 

Source
pub struct EventsManager { /* private fields */ }
Expand description

The events manager providing access to Calendar events via EventKit

Implementations§

Source§

impl EventsManager

Source

pub fn new() -> Self

Creates a new EventsManager instance

Source

pub fn authorization_status() -> AuthorizationStatus

Gets the current authorization status for calendar events

Source

pub fn request_access(&self) -> Result<bool>

Requests full access to calendar events (blocking)

Returns Ok(true) if access was granted, Ok(false) if denied

Source

pub fn ensure_authorized(&self) -> Result<()>

Ensures we have authorization, requesting if needed

Source

pub fn list_calendars(&self) -> Result<Vec<CalendarInfo>>

Lists all event calendars

Source

pub fn default_calendar(&self) -> Result<CalendarInfo>

Gets the default calendar for new events

Source

pub fn fetch_today_events(&self) -> Result<Vec<EventItem>>

Fetches events for today

Source

pub fn fetch_upcoming_events(&self, days: i64) -> Result<Vec<EventItem>>

Fetches events for the next N days

Source

pub fn fetch_events( &self, start: DateTime<Local>, end: DateTime<Local>, calendar_titles: Option<&[&str]>, ) -> Result<Vec<EventItem>>

Fetches events in a date range

Source

pub fn create_event( &self, title: &str, start: DateTime<Local>, end: DateTime<Local>, notes: Option<&str>, location: Option<&str>, calendar_title: Option<&str>, all_day: bool, ) -> Result<EventItem>

Creates a new event

Source

pub fn update_event( &self, identifier: &str, title: Option<&str>, notes: Option<&str>, location: Option<&str>, start: Option<DateTime<Local>>, end: Option<DateTime<Local>>, ) -> Result<EventItem>

Updates an existing event

Source

pub fn delete_event(&self, identifier: &str, affect_future: bool) -> Result<()>

Deletes an event

Source

pub fn get_event(&self, identifier: &str) -> Result<EventItem>

Gets an event by its identifier

Source

pub fn create_event_calendar(&self, title: &str) -> Result<CalendarInfo>

Creates a new event calendar.

Source

pub fn rename_event_calendar( &self, identifier: &str, new_title: &str, ) -> Result<CalendarInfo>

Renames an event calendar. Rename an event calendar (backward compat wrapper).

Source

pub fn update_event_calendar( &self, identifier: &str, new_title: Option<&str>, color_rgba: Option<(f64, f64, f64, f64)>, ) -> Result<CalendarInfo>

Update an event calendar — name, color, or both.

Source

pub fn delete_event_calendar(&self, identifier: &str) -> Result<()>

Deletes an event calendar.

Source

pub fn get_event_alarms(&self, identifier: &str) -> Result<Vec<AlarmInfo>>

Lists all alarms on an event.

Source

pub fn add_event_alarm(&self, identifier: &str, alarm: &AlarmInfo) -> Result<()>

Adds an alarm to an event.

Source

pub fn get_event_recurrence_rules( &self, identifier: &str, ) -> Result<Vec<RecurrenceRule>>

Gets recurrence rules on an event.

Source

pub fn set_event_recurrence_rule( &self, identifier: &str, rule: &RecurrenceRule, ) -> Result<()>

Sets a recurrence rule on an event (replaces any existing rules).

Source

pub fn remove_event_recurrence_rules(&self, identifier: &str) -> Result<()>

Removes all recurrence rules from an event.

Source

pub fn remove_event_alarm(&self, identifier: &str, index: usize) -> Result<()>

Removes a specific alarm from an event by index.

Source

pub fn set_event_url(&self, identifier: &str, url: Option<&str>) -> Result<()>

Set or clear the URL on an event.

Trait Implementations§

Source§

impl Default for EventsManager

Source§

fn default() -> Self

Returns the “default value” for a type. 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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

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