pub struct Aim { /* private fields */ }Expand description
AIM calendar application core.
Implementations§
Source§impl Aim
impl Aim
Sourcepub async fn new(config: Config) -> Result<Self, Box<dyn Error>>
pub async fn new(config: Config) -> Result<Self, Box<dyn Error>>
Creates a new AIM instance with the given configuration.
Sourcepub fn refresh_now(&mut self)
pub fn refresh_now(&mut self)
Refresh the current time to now.
Sourcepub fn default_event_draft(&self) -> EventDraft
pub fn default_event_draft(&self) -> EventDraft
Create a default event draft based on the AIM configuration.
Sourcepub async fn new_event(
&self,
draft: EventDraft,
) -> Result<impl Event + 'static, Box<dyn Error>>
pub async fn new_event( &self, draft: EventDraft, ) -> Result<impl Event + 'static, Box<dyn Error>>
Add a new event from the given draft.
Sourcepub async fn update_event(
&self,
id: &Id,
patch: EventPatch,
) -> Result<impl Event + 'static, Box<dyn Error>>
pub async fn update_event( &self, id: &Id, patch: EventPatch, ) -> Result<impl Event + 'static, Box<dyn Error>>
Upsert an event into the calendar.
Sourcepub async fn get_kind(&self, id: &Id) -> Result<Kind, Box<dyn Error>>
pub async fn get_kind(&self, id: &Id) -> Result<Kind, Box<dyn Error>>
Get the kind of the given id, which can be either an event or a todo.
Sourcepub async fn get_event(
&self,
id: &Id,
) -> Result<impl Event + 'static, Box<dyn Error>>
pub async fn get_event( &self, id: &Id, ) -> Result<impl Event + 'static, Box<dyn Error>>
Get a event by its id.
Sourcepub async fn list_events(
&self,
conds: &EventConditions,
pager: &Pager,
) -> Result<Vec<impl Event + 'static>, Box<dyn Error>>
pub async fn list_events( &self, conds: &EventConditions, pager: &Pager, ) -> Result<Vec<impl Event + 'static>, Box<dyn Error>>
List events matching the given conditions.
Sourcepub async fn count_events(&self, conds: &EventConditions) -> Result<i64, Error>
pub async fn count_events(&self, conds: &EventConditions) -> Result<i64, Error>
Counts the number of events matching the given conditions.
Sourcepub fn default_todo_draft(&self) -> TodoDraft
pub fn default_todo_draft(&self) -> TodoDraft
Create a default todo draft based on the AIM configuration.
Sourcepub async fn new_todo(
&self,
draft: TodoDraft,
) -> Result<impl Todo + 'static, Box<dyn Error>>
pub async fn new_todo( &self, draft: TodoDraft, ) -> Result<impl Todo + 'static, Box<dyn Error>>
Add a new todo from the given draft.
Sourcepub async fn update_todo(
&self,
id: &Id,
patch: TodoPatch,
) -> Result<impl Todo + 'static, Box<dyn Error>>
pub async fn update_todo( &self, id: &Id, patch: TodoPatch, ) -> Result<impl Todo + 'static, Box<dyn Error>>
Upsert an event into the calendar.
Sourcepub async fn get_todo(
&self,
id: &Id,
) -> Result<impl Todo + 'static, Box<dyn Error>>
pub async fn get_todo( &self, id: &Id, ) -> Result<impl Todo + 'static, Box<dyn Error>>
Get a todo by its id.
Sourcepub async fn list_todos(
&self,
conds: &TodoConditions,
sort: &[TodoSort],
pager: &Pager,
) -> Result<Vec<impl Todo + 'static>, Box<dyn Error>>
pub async fn list_todos( &self, conds: &TodoConditions, sort: &[TodoSort], pager: &Pager, ) -> Result<Vec<impl Todo + 'static>, Box<dyn Error>>
List todos matching the given conditions, sorted and paginated.
Sourcepub async fn count_todos(&self, conds: &TodoConditions) -> Result<i64, Error>
pub async fn count_todos(&self, conds: &TodoConditions) -> Result<i64, Error>
Counts the number of todos matching the given conditions.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Aim
impl !RefUnwindSafe for Aim
impl Send for Aim
impl Sync for Aim
impl Unpin for Aim
impl !UnwindSafe for Aim
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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