pub struct Activity { /* private fields */ }Expand description
The activity entity
The activity entity is used to store and manage an activity
Implementations§
source§impl Activity
impl Activity
sourcepub fn builder() -> ActivityBuilder<((), (), (), (), (), (), (), ())>
pub fn builder() -> ActivityBuilder<((), (), (), (), (), (), (), ())>
Create a builder for building Activity.
On the builder, call .category(...)(optional), .description(...), .begin(...)(optional), .activity_end_options(...)(optional), .kind(...)(optional), .activity_kind_options(...)(optional), .pomodoro_cycle_options(...)(optional), .status(...)(optional) to set the values of the fields.
Finally, call .build() to create the instance of Activity.
source§impl Activity
impl Activity
sourcepub fn description(&self) -> &String
pub fn description(&self) -> &String
The description of the activity
sourcepub fn begin(&self) -> &PaceDateTime
pub fn begin(&self) -> &PaceDateTime
The start date and time of the activity
pub fn activity_end_options(&self) -> &Option<ActivityEndOptions>
sourcepub fn kind(&self) -> &ActivityKind
pub fn kind(&self) -> &ActivityKind
The kind of activity
sourcepub fn activity_kind_options(&self) -> &Option<ActivityKindOptions>
pub fn activity_kind_options(&self) -> &Option<ActivityKindOptions>
Optional attributes for the activity kind
sourcepub fn pomodoro_cycle_options(&self) -> &Option<PomodoroCycle>
pub fn pomodoro_cycle_options(&self) -> &Option<PomodoroCycle>
The pomodoro cycle of the activity
pub fn status(&self) -> &ActivityStatus
source§impl Activity
impl Activity
sourcepub fn set_category(&mut self, val: Option<String>) -> &mut Self
pub fn set_category(&mut self, val: Option<String>) -> &mut Self
The category of the activity
sourcepub fn set_description(&mut self, val: String) -> &mut Self
pub fn set_description(&mut self, val: String) -> &mut Self
The description of the activity
sourcepub fn set_begin(&mut self, val: PaceDateTime) -> &mut Self
pub fn set_begin(&mut self, val: PaceDateTime) -> &mut Self
The start date and time of the activity
pub fn set_activity_end_options( &mut self, val: Option<ActivityEndOptions> ) -> &mut Self
sourcepub fn set_kind(&mut self, val: ActivityKind) -> &mut Self
pub fn set_kind(&mut self, val: ActivityKind) -> &mut Self
The kind of activity
sourcepub fn set_activity_kind_options(
&mut self,
val: Option<ActivityKindOptions>
) -> &mut Self
pub fn set_activity_kind_options( &mut self, val: Option<ActivityKindOptions> ) -> &mut Self
Optional attributes for the activity kind
sourcepub fn set_pomodoro_cycle_options(
&mut self,
val: Option<PomodoroCycle>
) -> &mut Self
pub fn set_pomodoro_cycle_options( &mut self, val: Option<PomodoroCycle> ) -> &mut Self
The pomodoro cycle of the activity
pub fn set_status(&mut self, val: ActivityStatus) -> &mut Self
source§impl Activity
impl Activity
sourcepub fn category_mut(&mut self) -> &mut Option<String>
pub fn category_mut(&mut self) -> &mut Option<String>
The category of the activity
sourcepub fn description_mut(&mut self) -> &mut String
pub fn description_mut(&mut self) -> &mut String
The description of the activity
sourcepub fn begin_mut(&mut self) -> &mut PaceDateTime
pub fn begin_mut(&mut self) -> &mut PaceDateTime
The start date and time of the activity
pub fn activity_end_options_mut(&mut self) -> &mut Option<ActivityEndOptions>
sourcepub fn kind_mut(&mut self) -> &mut ActivityKind
pub fn kind_mut(&mut self) -> &mut ActivityKind
The kind of activity
sourcepub fn activity_kind_options_mut(&mut self) -> &mut Option<ActivityKindOptions>
pub fn activity_kind_options_mut(&mut self) -> &mut Option<ActivityKindOptions>
Optional attributes for the activity kind
sourcepub fn pomodoro_cycle_options_mut(&mut self) -> &mut Option<PomodoroCycle>
pub fn pomodoro_cycle_options_mut(&mut self) -> &mut Option<PomodoroCycle>
The pomodoro cycle of the activity
pub fn status_mut(&mut self) -> &mut ActivityStatus
source§impl Activity
impl Activity
sourcepub fn new_from_self(&self) -> Self
pub fn new_from_self(&self) -> Self
Create a new activity from this activity to resume an already ended/archived/etc. activity
sourcepub fn is_active(&self) -> bool
pub fn is_active(&self) -> bool
If the activity is active, so if it is currently being tracked
Intermissions are not considered active activities, please use
[is_active_intermission] for that
sourcepub fn make_active(&mut self)
pub fn make_active(&mut self)
Make the activity active
sourcepub fn make_inactive(&mut self)
pub fn make_inactive(&mut self)
Make the activity inactive
sourcepub fn archive(&mut self)
pub fn archive(&mut self)
Archive the activity This is only possible if the activity is not active and has ended
sourcepub fn unarchive(&mut self)
pub fn unarchive(&mut self)
Unarchive the activity This is only possible if the activity is archived
sourcepub fn is_active_intermission(&self) -> bool
pub fn is_active_intermission(&self) -> bool
If the activity is an active intermission
sourcepub fn is_archived(&self) -> bool
pub fn is_archived(&self) -> bool
If the activity is archived
sourcepub fn is_inactive(&self) -> bool
pub fn is_inactive(&self) -> bool
If the activity is inactive
sourcepub fn end_activity(&mut self, end_opts: ActivityEndOptions)
pub fn end_activity(&mut self, end_opts: ActivityEndOptions)
End the activity
§Arguments
end- The end date and time of the activityduration- ThePaceDurationof the activity
sourcepub fn end_activity_with_duration_calc(
&mut self,
begin: PaceDateTime,
end: PaceDateTime
) -> PaceResult<()>
pub fn end_activity_with_duration_calc( &mut self, begin: PaceDateTime, end: PaceDateTime ) -> PaceResult<()>
End the activity with a given end date and time
§Arguments
begin- The begin date and time of the activity (for calculating the duration)end- The end date and time of the activity
§Errors
Returns an error if the duration cannot be calculated
§Returns
Returns Ok(()) if the activity is ended successfully
sourcepub fn parent_id(&self) -> Option<ActivityGuid>
pub fn parent_id(&self) -> Option<ActivityGuid>
Get parent_id if activity is intermission
§Returns
Some(ActivityGuid)- Theparent_idof the activityNone- If the activity is not an intermission
Trait Implementations§
source§impl<'de> Deserialize<'de> for Activity
impl<'de> Deserialize<'de> for Activity
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl From<Activity> for ActivityItem
impl From<Activity> for ActivityItem
source§impl PartialEq for Activity
impl PartialEq for Activity
impl Eq for Activity
impl StructuralPartialEq for Activity
Auto Trait Implementations§
impl RefUnwindSafe for Activity
impl Send for Activity
impl Sync for Activity
impl Unpin for Activity
impl UnwindSafe for Activity
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
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more