Skip to main content

selection_capture/
traits.rs

1use crate::profile::{AppProfile, AppProfileUpdate};
2use crate::types::{
3    ActiveApp, CaptureFailureContext, CaptureMethod, CleanupStatus, PlatformAttemptResult, UserHint,
4};
5
6pub trait CancelSignal {
7    fn is_cancelled(&self) -> bool;
8}
9
10pub trait AppProfileStore {
11    fn load(&self, app: &ActiveApp) -> AppProfile;
12    fn merge_update(&self, app: &ActiveApp, update: AppProfileUpdate);
13}
14
15pub trait AppAdapter: Send + Sync {
16    fn matches(&self, app: &ActiveApp) -> bool;
17    fn strategy_override(&self, app: &ActiveApp) -> Option<Vec<CaptureMethod>>;
18    fn hint_override(&self, context: &CaptureFailureContext) -> Option<UserHint>;
19}
20
21pub trait CapturePlatform {
22    fn active_app(&self) -> Option<ActiveApp>;
23    fn attempt(&self, method: CaptureMethod, app: Option<&ActiveApp>) -> PlatformAttemptResult;
24    fn cleanup(&self) -> CleanupStatus;
25}
26
27pub trait MonitorPlatform {
28    fn next_selection_change(&self) -> Option<String>;
29}