1pub use tilo_platform_caps::{Availability, availability, available};
4
5pub type Unsupported = tilo_platform_caps::Unsupported<Feature>;
6
7#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
8#[non_exhaustive]
9pub enum Feature {
10 Text,
11 ReadAnytime,
12 Images,
13 PrimarySelection,
14}
15
16pub(crate) const WEB_READ: &str = "A web page reads the clipboard only while the user pastes.";
17pub(crate) const WEB_IMAGES: &str = "Tilo copies only text in the browser.";
18pub(crate) const MAC_PRIMARY: &str = "macOS has no middle-click selection.";
19pub(crate) const WEB_PRIMARY: &str = "Browsers have no middle-click selection.";
20
21impl tilo_platform_caps::Feature for Feature {
22 fn targets(self) -> [Availability; 3] {
27 use Availability::{Available, Unsupported};
28 match self {
29 Self::Text => [Available, Available, Available],
30 Self::ReadAnytime => [Available, Available, Unsupported(WEB_READ)],
31 Self::Images => [Available, Available, Unsupported(WEB_IMAGES)],
32 Self::PrimarySelection => [
33 Available,
34 Unsupported(MAC_PRIMARY),
35 Unsupported(WEB_PRIMARY),
36 ],
37 }
38 }
39}
40
41#[cfg(test)]
42mod tests {
43 use super::*;
44
45 #[test]
46 fn this_target_reads_its_own_column() {
47 assert_eq!(availability(Feature::Text), Availability::Available);
48 }
49}