pub struct AppleCalendar { /* private fields */ }Expand description
A connected Apple Calendar, used by tum_apple_sync.
Cloning is cheap (the underlying connection pool is shared), so the handle can be created once and moved into a callback.
§Examples
let apple_calendar = AppleCalendar::connect("me@icloud.com", "abcd-efgh-ijkl-mnop", "TUM")
.await
.expect("Failed to connect to the Apple Calendar");Implementations§
Source§impl AppleCalendar
impl AppleCalendar
Sourcepub async fn connect(
apple_id: &str,
app_password: &str,
calendar_name: &str,
) -> Result<Self, Box<dyn Error + Send + Sync>>
pub async fn connect( apple_id: &str, app_password: &str, calendar_name: &str, ) -> Result<Self, Box<dyn Error + Send + Sync>>
Connects to the iCloud calendar named calendar_name.
app_password has to be an app-specific password,
your regular Apple ID password won’t be accepted.
Sourcepub async fn connect_to(
server_url: &str,
username: &str,
password: &str,
calendar_name: &str,
) -> Result<Self, Box<dyn Error + Send + Sync>>
pub async fn connect_to( server_url: &str, username: &str, password: &str, calendar_name: &str, ) -> Result<Self, Box<dyn Error + Send + Sync>>
Same as AppleCalendar::connect, but for any other CalDAV server
(Fastmail, Nextcloud, Radicale, …).
Sourcepub fn from_calendar_url(
username: &str,
password: &str,
calendar_url: &str,
) -> Result<Self, Box<dyn Error + Send + Sync>>
pub fn from_calendar_url( username: &str, password: &str, calendar_url: &str, ) -> Result<Self, Box<dyn Error + Send + Sync>>
Skips the discovery and uses the calendar collection at calendar_url directly.
Sourcepub async fn with_exam_calendar(
self,
calendar_name: &str,
) -> Result<Self, Box<dyn Error + Send + Sync>>
pub async fn with_exam_calendar( self, calendar_name: &str, ) -> Result<Self, Box<dyn Error + Send + Sync>>
Puts exams (events with “Prüfung” in their title) into the calendar named
calendar_name instead, so that they can have a color of their own - Apple Calendar
only colors whole calendars, not single events. It has to belong to the same account.
Exams which are in the main calendar already can be moved over with
move_exams_to_exam_calendar.
Sourcepub fn with_exam_calendar_url(
self,
calendar_url: &str,
) -> Result<Self, Box<dyn Error + Send + Sync>>
pub fn with_exam_calendar_url( self, calendar_url: &str, ) -> Result<Self, Box<dyn Error + Send + Sync>>
Same as AppleCalendar::with_exam_calendar, but skips the discovery and uses the
calendar collection at calendar_url directly.
pub fn calendar_url(&self) -> &str
pub fn exam_calendar_url(&self) -> Option<&str>
Trait Implementations§
Source§impl Clone for AppleCalendar
impl Clone for AppleCalendar
Auto Trait Implementations§
impl !RefUnwindSafe for AppleCalendar
impl !UnwindSafe for AppleCalendar
impl Freeze for AppleCalendar
impl Send for AppleCalendar
impl Sync for AppleCalendar
impl Unpin for AppleCalendar
impl UnsafeUnpin for AppleCalendar
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more