You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(axum): Expose IntrospectionConfig to facilitate creating Axum substates (#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()
}
}
```
0 commit comments