Can't have generics on app state marked with FromRef? #1872
-
I was trying to get dependency injection to work more or less nicely with generics, but I got kinda stomped before I could even begin. Let's say I have this #[derive(Clone, FromRef)]
struct AppState<T: ApiClient> {
thing: T,
}
trait ApiClient {
fn do_the_thing(&self);
} Rust then complains with the following error:
Obviously |
Beta Was this translation helpful? Give feedback.
Answered by
davidpdrsn
Mar 22, 2023
Replies: 1 comment 4 replies
-
Try writing a manual implementation. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try writing a manual implementation.