From: Ian Jackson Date: Wed, 3 Apr 2024 13:33:25 +0000 (+0100) Subject: wip X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=a421309e6923b2f16bc788f423758d59584445fd;p=rust-experiments.git wip --- diff --git a/src/main.rs b/src/main.rs index bef15e6..c1ab913 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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 { - #[educe(Debug(ignore))] - data: Arc, +#[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()) }