Skip to content
Discussion options

You must be logged in to vote

In my experience, I'm using the dynamic dispatch like this:

pub type DynDatabaseRepository = Box<dyn DatabaseRepository + Send + Sync>;

I use DynDatabaseRepository on my Environment struct.
And I put the Environment in the AppState.
I don't need any trait bounds on all handlers with that approach.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@pemattern
Comment options

@jplatte
Comment options

@pemattern
Comment options

Answer selected by pemattern
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants