dtolnay / typetag

Serde serializable and deserializable trait objects
Apache License 2.0
1.19k stars 38 forks source link

Niche incompatibility with axum + deadpool-diesel #76

Closed manstie closed 2 months ago

manstie commented 7 months ago

I'm not sure if this belongs here but I have to start somewhere. I've never encountered an issue like this before in rust, but it seems I can work around it by not using this crate.

I have a minimal reproducible example here: https://github.com/manstie/axum-typetag

See the readme for error details.

dtolnay commented 2 months ago

Your issue is unrelated to this crate. You could have figured this out by removing all use of typetag from your program.

- let payload = serde_json::to_value(queueable)?;
+ drop(queueable);
+ let payload = serde_json::Value::Null;

(And removing typetag::serde attributes.) The error is the same.

You are missing a Send bound. Holding queueable across an await point requires it to be sendable across threads.

- let queueable: Box<dyn Queueable> = Box::new(example.clone());
+ let queueable: Box<dyn Queueable + Send> = Box::new(example.clone());