Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(axum): Expose
IntrospectionConfig
to facilitate creating Axum s…
…ubstates (#523) # Problem Can't inject other dependencies while using `IntrospectionState` as the only state in Axum. Embedding `IntrospectionState` in an `AppState` object that includes other dependencies renders `IntrospectedUser` unusable since it would require an implementation for `FromRef<AppState> for IntrospectionConfig` which in its turn not possible due to `IntrospectionConfig` inside `IntrospectionState` not being public/does not have a public getter. # Solution Since `IntrospectionState` is built using `IntrospectionStateBuilder` it doesn't make sense to expose the field directly. A getter makes more sense :) # Usage Example ```rust struct AppState { some_other_dep: String, introspection_state: IntrospectionState, } impl FromRef<AppState> for IntrospectionConfig { fn from_ref(input: &AppState) -> Self { input.introspection_state.config.clone() } } ```
- Loading branch information