pub enum StorageKind {
    ActivityStore(ActivityStore),
    InMemoryActivityStorage(InMemoryActivityStorage),
    TomlActivityStorage(TomlActivityStorage),
}

Variants§

§

ActivityStore(ActivityStore)

§

InMemoryActivityStorage(InMemoryActivityStorage)

§

TomlActivityStorage(TomlActivityStorage)

Trait Implementations§

source§

impl ActivityQuerying for StorageKind

source§

fn group_activities_by_duration_range( &self ) -> PaceOptResult<BTreeMap<PaceDurationRange, Vec<ActivityItem>>>

Group activities by predefined duration ranges (e.g., short, medium, long).

This is useful for analyzing how time is spent on different activities.

§Errors

This function should return an error if the activities cannot be loaded.

§Returns

A collection of the activities that are grouped by their duration range. The key is the duration range, and the value is a list of activities that fall within that range. If no activities are found, it should return Ok(None).

source§

fn group_activities_by_start_date( &self ) -> PaceOptResult<BTreeMap<PaceDate, Vec<ActivityItem>>>

Group activities by their start date. This can help in analyzing how activities are distributed over time.

§Errors

This function should return an error if the activities cannot be loaded.

§Returns

A collection of the activities that are grouped by their start date. The key is the start date of the activity, and the value is a list of activities that started on that date.

source§

fn list_activities_with_intermissions( &self ) -> PaceOptResult<BTreeMap<ActivityGuid, Vec<ActivityItem>>>

Retrieve activities that have one or more intermissions, useful for identifying potential inefficiencies or breaks.

§Errors

This function should return an error if the activities cannot be loaded.

§Returns

A collection of the activities that have intermissions. The key is the ID of the activity, and the value is a list of intermissions. If no activities are found, it should return Ok(None).

source§

fn group_activities_by_keywords( &self, __enum_dispatch_arg_0: KeywordOptions ) -> PaceOptResult<BTreeMap<String, Vec<ActivityItem>>>

Group activities based on keywords, e.g., category, tags, etc.

This is useful for analyzing time spent on different projects or areas of work.

§Arguments
  • keyword_opts - The keyword options to filter the activities by.
§Errors

This function should return an error if the activities cannot be loaded.

§Returns

A collection of the activities that are matching the KeywordOptions. The key is the keyword, and the value is a list of matching activities. If no activities are found, it should return Ok(None).

source§

fn group_activities_by_kind( &self ) -> PaceOptResult<BTreeMap<ActivityKind, Vec<ActivityItem>>>

Group activities based on their kind (e.g., Task, Intermission).

§Errors

This function should return an error if the activities cannot be loaded.

§Returns

A collection of the activities with their kind. The key is the kind of the activity, and the value is a list of activities of that kind. If no activities are found, it should return Ok(None).

source§

fn list_activities_by_time_range( &self, __enum_dispatch_arg_0: TimeRangeOptions ) -> PaceOptResult<Vec<ActivityItem>>

List activities by time range from the storage backend.

§Arguments
  • time_range_opts - The range options to filter the activities by.
§Errors

This function should return an error if the activities cannot be loaded.

§Returns

A collection of the activities that are matching the RangeOptions. If no activities are found, it should return Ok(None).

source§

fn group_activities_by_status( &self ) -> PaceOptResult<BTreeMap<ActivityStatus, Vec<ActivityItem>>>

Group activities by their status from the storage backend.

§Errors

This function should return an error if the activities cannot be loaded.

§Returns

A collection of the activities by their status. If no activities are found, it should return Ok(None).

source§

fn list_current_activities( &self, __enum_dispatch_arg_0: ActivityStatusFilter ) -> PaceOptResult<Vec<ActivityGuid>>

List all current activities from the storage backend matching an ActivityFilter.

§Errors

This function should return an error if the activities cannot be loaded. In case of no activities, it should return Ok(None).

§Returns

A collection of the activities that are matching the ActivityFilter.

source§

fn list_activities_by_id( &self ) -> PaceOptResult<BTreeMap<ActivityGuid, Activity>>

Get all activities by their ID.

§Errors

This function should return an error if the activities cannot be loaded.

§Returns

A collection of the activities that were loaded from the storage backend by their ID in a BTreeMap. If no activities are found, it should return Ok(None).

source§

fn list_active_intermissions(&self) -> PaceOptResult<Vec<ActivityGuid>>

List all active intermissions from the storage backend.

§Errors

This function should return an error if the activities cannot be loaded.

§Returns

A collection of the activities that are currently active intermissions. If no activities are found, it should return Ok(None).

source§

fn list_most_recent_activities( &self, __enum_dispatch_arg_0: usize ) -> PaceOptResult<Vec<ActivityGuid>>

List the most recent activities from the storage backend.

§Arguments
  • count - The number of activities to list.
§Errors

This function should return an error if the activities cannot be loaded.

§Returns

A collection of the most recent activities. If no activities are found, it should return Ok(None).

source§

fn is_activity_active( &self, __enum_dispatch_arg_0: ActivityGuid ) -> PaceResult<bool>

Check if an activity is currently active.

§Arguments
  • activity_id - The ID of the activity to check.
§Errors

This function should return an error if the activity cannot be checked.

§Returns

If the activity is active, it should return Ok(true). If it is not active, it should return Ok(false).

source§

fn list_active_intermissions_for_activity_id( &self, __enum_dispatch_arg_0: ActivityGuid ) -> PaceOptResult<Vec<ActivityGuid>>

Check if an activity currently has one or more active intermissions.

§Arguments
  • activity_id - The ID of the activity to check.
§Errors

This function should return an error if the activity cannot be checked.

§Returns

If the activity has active intermissions, it should return Ok(Option<VecDeque<ActivityGuid>>) with the IDs of the active intermissions. If it has no active intermissions, it should return Ok(None).

source§

fn most_recent_active_activity(&self) -> PaceOptResult<ActivityItem>

Get the latest active activity.

§Errors

This function should return an error if the activity cannot be loaded.

§Returns

The latest active activity. If no activity is found, it should return Ok(None).

source§

fn most_recent_held_activity(&self) -> PaceOptResult<ActivityItem>

Get the latest held activity.

§Errors

This function should return an error if the activity cannot be loaded.

§Returns

The latest held activity. If no activity is found, it should return Ok(None).

source§

impl ActivityReadOps for StorageKind

source§

fn read_activity( &self, __enum_dispatch_arg_0: ActivityGuid ) -> PaceResult<ActivityItem>

Read an activity from the storage backend.

§Arguments
  • activity_id - The ID of the activity to read.
§Errors

This function should return an error if the activity cannot be read.

§Returns

The activity that was read from the storage backend. If no activity is found, it should return Ok(None).

source§

fn list_activities( &self, __enum_dispatch_arg_0: ActivityStatusFilter ) -> PaceOptResult<FilteredActivities>

List activities from the storage backend.

§Arguments
  • filter - The filter to apply to the activities.
§Errors

This function should return an error if the activities cannot be loaded.

§Returns

A collection of the activities that were loaded from the storage backend. Returns Ok(None) if no activities are found.

source§

impl ActivityStateManagement for StorageKind

source§

fn begin_activity( &self, __enum_dispatch_arg_0: Activity ) -> PaceResult<ActivityItem>

Begin an activity in the storage backend. This makes the activity active.

§Arguments
  • activity - The activity to start.
§Errors

This function should return an error if the activity cannot be started.

§Returns

If the activity was started successfully it should return the ID of the started activity.

source§

fn hold_activity( &self, __enum_dispatch_arg_0: ActivityGuid, __enum_dispatch_arg_1: HoldOptions ) -> PaceResult<ActivityItem>

Hold an activity in the storage backend.

§Arguments
  • activity_id - The ID of the activity to hold.
  • hold_opts - The options to hold the activity.
§Errors

This function should return an error if the activity cannot be held.

§Returns

If the activity was held successfully it should return the ActivityItem of the held activity.

source§

fn resume_activity( &self, __enum_dispatch_arg_0: ActivityGuid, __enum_dispatch_arg_1: ResumeOptions ) -> PaceResult<ActivityItem>

Resume an activity in the storage backend.

§Arguments
  • activity_id - The ID of the activity to resume. If None, the last unfinished activity is resumed.
  • resume_time - The time (HH:MM) to resume the activity at. If None, the current time is used.
§Errors

This function should return an error if the activity cannot be resumed.

§Returns

The activity that was resumed. Returns Ok(None) if no activity was resumed.

source§

fn resume_most_recent_activity( &self, __enum_dispatch_arg_0: ResumeOptions ) -> PaceOptResult<ActivityItem>

Resume the most recent activity in the storage backend.

§Arguments
  • resume_opts - The options to resume the activity.
§Errors

This function should return an error if the activity cannot be resumed.

§Returns

The activity that was resumed. Returns Ok(None) if no activity was resumed.

source§

fn end_activity( &self, __enum_dispatch_arg_0: ActivityGuid, __enum_dispatch_arg_1: EndOptions ) -> PaceResult<ActivityItem>

End an activity in the storage backend.

§Arguments
  • activity_id - The ID of the activity to end.
  • end_opts - The options to end the activity.
§Errors

This function should return an error if the activity cannot be ended.

§Returns

If the activity was ended successfully it should return the ID of the ended activity.

source§

fn end_all_unfinished_activities( &self, __enum_dispatch_arg_0: EndOptions ) -> PaceOptResult<Vec<ActivityItem>>

End all unfinished activities in the storage backend.

§Arguments
  • end_opts - The options to end the activities.
§Errors

This function should return an error if the activities cannot be ended.

§Returns

A collection of the activities that were ended. Returns Ok(None) if no activities were ended.

source§

fn end_all_active_intermissions( &self, __enum_dispatch_arg_0: EndOptions ) -> PaceOptResult<Vec<ActivityGuid>>

End all active intermissions in the storage backend.

§Arguments
  • end_opts - The options to end the intermissions.
§Errors

This function should return an error if the intermissions cannot be ended.

§Returns

A collection of the intermissions that were ended. Returns Ok(None) if no intermissions were ended.

source§

fn end_last_unfinished_activity( &self, __enum_dispatch_arg_0: EndOptions ) -> PaceOptResult<ActivityItem>

End the last unfinished activity in the storage backend.

§Arguments
  • end_opts - The options to end the activity.
§Errors

This function should return an error if the activity cannot be ended.

§Returns

The activity that was ended. Returns Ok(None) if no activity was ended.

source§

fn hold_most_recent_active_activity( &self, __enum_dispatch_arg_0: HoldOptions ) -> PaceOptResult<ActivityItem>

Hold the most recent activity that is active in the storage backend.

§Arguments
  • hold_opts - The options to hold the activity.
§Errors

This function should return an error if the activity cannot be held or if there are no activities to hold.

§Returns

The activity that was held if there was an unfinished activity to hold. If there are no activities to hold, it should return Ok(None).

§Note

This function should not be used to hold an activity that is already held. It should only be used to hold the last unfinished activity.

source§

impl ActivityStorage for StorageKind

source§

fn setup_storage(&self) -> PaceResult<()>

Setup the storage backend. This is called once when the application starts.

This is where you would create the database tables, open the file, etc.

§Errors

This function should return an error if the storage backend cannot be setup.

source§

impl ActivityWriteOps for StorageKind

source§

fn create_activity( &self, __enum_dispatch_arg_0: Activity ) -> PaceResult<ActivityItem>

Create an activity in the storage backend.

§Arguments
  • activity - The activity to create.
§Errors

This function should return an error if the activity cannot be created.

§Returns

If the activity was created successfully it should return the ID of the created activity.

source§

fn update_activity( &self, __enum_dispatch_arg_0: ActivityGuid, __enum_dispatch_arg_1: Activity, __enum_dispatch_arg_2: UpdateOptions ) -> PaceResult<ActivityItem>

Update an existing activity in the storage backend.

§Note

This function should not be used to update the state of an activity (e.g., start, end, hold, resume) directly. Use the ActivityStateManagement trait for that. This function is only for updating (as in replacing) the complete data of an activity.

Warning: It can’t be used to update the ID of an activity, because that’s the primary key. So it is immutable.

§Arguments
  • activity_id - The ID of the activity to update.
  • activity - The updated activity data.
§Errors

This function should return an error if the activity cannot be updated.

§Returns

If the activity was updated successfully it should return the original activity before it was updated.

source§

fn delete_activity( &self, __enum_dispatch_arg_0: ActivityGuid, __enum_dispatch_arg_1: DeleteOptions ) -> PaceResult<ActivityItem>

Delete an activity from the storage backend.

§Arguments
  • activity_id - The ID of the activity to delete.
§Errors

This function should return an error if the activity cannot be deleted.

§Returns

If the activity was deleted successfully it should return the activity that was deleted.

source§

impl From<ActivityStore> for StorageKind

source§

fn from(v: ActivityStore) -> StorageKind

Converts to this type from the input type.
source§

impl From<InMemoryActivityStorage> for StorageKind

source§

fn from(v: InMemoryActivityStorage) -> StorageKind

Converts to this type from the input type.
source§

impl From<TomlActivityStorage> for StorageKind

source§

fn from(v: TomlActivityStorage) -> StorageKind

Converts to this type from the input type.
source§

impl SyncStorage for StorageKind

source§

fn sync(&self) -> PaceResult<()>

Sync the storage to a persistent medium.

§Errors

This function should return an error if the storage cannot be synced.

§Returns

If the storage was synced successfully it should return Ok(()).

source§

impl TryInto<ActivityStore> for StorageKind

§

type Error = &'static str

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

fn try_into( self ) -> Result<ActivityStore, <Self as TryInto<ActivityStore>>::Error>

Performs the conversion.
source§

impl TryInto<InMemoryActivityStorage> for StorageKind

§

type Error = &'static str

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

fn try_into( self ) -> Result<InMemoryActivityStorage, <Self as TryInto<InMemoryActivityStorage>>::Error>

Performs the conversion.
source§

impl TryInto<TomlActivityStorage> for StorageKind

§

type Error = &'static str

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

fn try_into( self ) -> Result<TomlActivityStorage, <Self as TryInto<TomlActivityStorage>>::Error>

Performs the conversion.

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.

§

impl<D> OwoColorize for D

§

fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>
where C: Color,

Set the foreground color generically Read more
§

fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>
where C: Color,

Set the background color generically. Read more
§

fn black(&self) -> FgColorDisplay<'_, Black, Self>

Change the foreground color to black
§

fn on_black(&self) -> BgColorDisplay<'_, Black, Self>

Change the background color to black
§

fn red(&self) -> FgColorDisplay<'_, Red, Self>

Change the foreground color to red
§

fn on_red(&self) -> BgColorDisplay<'_, Red, Self>

Change the background color to red
§

fn green(&self) -> FgColorDisplay<'_, Green, Self>

Change the foreground color to green
§

fn on_green(&self) -> BgColorDisplay<'_, Green, Self>

Change the background color to green
§

fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>

Change the foreground color to yellow
§

fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>

Change the background color to yellow
§

fn blue(&self) -> FgColorDisplay<'_, Blue, Self>

Change the foreground color to blue
§

fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>

Change the background color to blue
§

fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to magenta
§

fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to magenta
§

fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to purple
§

fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to purple
§

fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>

Change the foreground color to cyan
§

fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>

Change the background color to cyan
§

fn white(&self) -> FgColorDisplay<'_, White, Self>

Change the foreground color to white
§

fn on_white(&self) -> BgColorDisplay<'_, White, Self>

Change the background color to white
§

fn default_color(&self) -> FgColorDisplay<'_, Default, Self>

Change the foreground color to the terminal default
§

fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>

Change the background color to the terminal default
§

fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>

Change the foreground color to bright black
§

fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>

Change the background color to bright black
§

fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>

Change the foreground color to bright red
§

fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>

Change the background color to bright red
§

fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>

Change the foreground color to bright green
§

fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>

Change the background color to bright green
§

fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>

Change the foreground color to bright yellow
§

fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>

Change the background color to bright yellow
§

fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>

Change the foreground color to bright blue
§

fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>

Change the background color to bright blue
§

fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright magenta
§

fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright magenta
§

fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright purple
§

fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright purple
§

fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>

Change the foreground color to bright cyan
§

fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>

Change the background color to bright cyan
§

fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>

Change the foreground color to bright white
§

fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>

Change the background color to bright white
§

fn bold(&self) -> BoldDisplay<'_, Self>

Make the text bold
§

fn dimmed(&self) -> DimDisplay<'_, Self>

Make the text dim
§

fn italic(&self) -> ItalicDisplay<'_, Self>

Make the text italicized
§

fn underline(&self) -> UnderlineDisplay<'_, Self>

Make the text italicized
Make the text blink
Make the text blink (but fast!)
§

fn reversed(&self) -> ReversedDisplay<'_, Self>

Swap the foreground and background colors
§

fn hidden(&self) -> HiddenDisplay<'_, Self>

Hide the text
§

fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>

Cross out the text
§

fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either 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,

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either OwoColorize::bg or a color-specific method, such as OwoColorize::on_yellow, Read more
§

fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the foreground color to a specific RGB value.
§

fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the background color to a specific RGB value.
§

fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>

Sets the foreground color to an RGB value.
§

fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>

Sets the background color to an RGB value.
§

fn style(&self, style: Style) -> Styled<&Self>

Apply a runtime-determined style
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

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

§

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

§

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V