Skip to content

AppState::from_ref(...) inside a impl<S> FromRequest<S> breaks trait bounds axum::serve #2722

Answered by jplatte
samuela asked this question in Q&A
Discussion options

You must be logged in to vote

Extensions and state are two entirely separate mechanisms. To make AppState available as state, use .with_state(AppState {}), not .layer(Extension(...)). For some examples, see Sharing state with handlers.

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

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

@marcalj
Comment options

@marcalj
Comment options

Answer selected by samuela
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
Converted from issue

This discussion was converted from issue #2721 on April 24, 2024 17:01.