chiark / gitweb /
wip
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 3 Apr 2024 13:33:25 +0000 (14:33 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 3 Apr 2024 13:33:25 +0000 (14:33 +0100)
src/main.rs

index bef15e62abf8526c35d1832bf8580e21ea6685f6..c1ab9138ed5a15885829ff24d8860c9f25ec80a7 100644 (file)
@@ -1,31 +1,19 @@
-#![allow(unused_imports)]
-#![allow(unreachable_pub)]
-#![allow(private_bounds)]
-#![allow(unused_variables)]
-
-use educe::Educe;
-use std::fmt::{self, Debug};
-use std::sync::Arc;
-
-trait Object {}
-
-impl Object for NotDebug {}
-
-#[derive(Educe)]
-#[educe(Clone(bound(T: Clone)), Debug(bound(T: Debug)))]
-//#[educe(Clone, Debug)]
-pub struct Obj<T: Object> {
-    #[educe(Debug(ignore))]
-    data: Arc<T>,
+#[derive(strum::EnumIter)]
+enum E {
+    Orange,
+    Lemon,
+    Apple,
 }
 
-#[derive(Clone)]
-struct NotDebug;
+impl E {
+    fn is_citrus(&self) -> bool {
+        match self {
+            E::Orange | E::Lemon => true,
+            E::Apple => false,
+        }
+    }
+}
 
-fn main() {
-    let a = Obj {
-        data: Arc::new(NotDebug),
-    };
-    let a = Clone::clone(&a);
-//    println!("{:?}", &a);
+pub fn all_citrus() {
+    E::iter().all(|e| e.is_citrus())
 }