chiark / gitweb /
repro?
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 26 Feb 2024 16:57:55 +0000 (16:57 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 26 Feb 2024 16:57:55 +0000 (16:57 +0000)
src/main.rs

index ba14590d023afc61eda3463dbb8fc65f004ebae3..d77a080b208b5f232df399f0b4f55a68d5abff48 100644 (file)
@@ -1,20 +1,38 @@
+#![allow(unused_imports)]
+
 use educe::Educe;
 use std::fmt::{self, Debug};
 
+trait Object {}
+trait ClientSideDb {}
+
+use std::sync::Arc;
+use Arc as DbPtr;
+use Arc as ClientDb;
+
+impl Object for NotDebug {}
+impl ClientSideDb for NotDebug {}
+
 #[derive(Educe)]
-#[educe(Debug(bound = "X: Debug"))]
-pub struct Thing<X> {
-    #[educe(Debug(method = "no_fmt"))]
-    field: Box<X>,
-}
+//#[educe(Clone, Debug(bound(T: Debug)))]
+#[educe(Clone(bound()), Debug)]
+pub struct Obj<T: Object, LocalDb: ClientSideDb> {
+    ptr: DbPtr<T>,
+    data: Arc<T>,
 
-fn no_fmt<Q>(_: &Q, _f: &mut fmt::Formatter) -> fmt::Result {
-    Ok(())
+    #[educe(Debug(ignore))]
+    db: Arc<ClientDb<LocalDb>>,
 }
 
+#[derive(Clone)]
+struct NotDebug;
+
 fn main() {
-    let a = Thing {
-        field: Box::new(42),
+    let a = Obj {
+        ptr: Arc::new(NotDebug),
+        data: Arc::new(NotDebug),
+        db: Arc::new(Arc::new(NotDebug)),
     };
-    println!("{:?}", &a);
+    let a = a.clone();
+//    println!("{:?}", &a);
 }