Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add map for ServiceConfig #1174

Merged
merged 1 commit into from
Oct 30, 2024
Merged

Conversation

juhaku
Copy link
Owner

@juhaku juhaku commented Oct 30, 2024

This commit adds map function for ServiceConfig to allow defining normal services to actix_web::web::ServiceConfig via ServiceConfig in similar fashion to Scope and UtoipaApp.

This example demonstrates the map functionality of ServiceConfig to allow direct access to underlying actix_web::web::ServiceConfig.

fn config(cfg: &mut service_config::ServiceConfig) {
    cfg.service(handler3)
        .map(|config| config.service(normal_service));
}

Closes #1173

This commit adds `map` function for `ServiceConfig` to allow defining
normal services to `actix_web::web::ServiceConfig` via `ServiceConfig`
in similar fashion to `Scope` and `UtoipaApp`.

This example demonstrates the `map` functionality of `ServiceConfig` to
allow direct access to underlying `actix_web::web::ServiceConfig`.
```rust
fn config(cfg: &mut service_config::ServiceConfig) {
    cfg.service(handler3)
        .map(|config| config.service(normal_service));
}
```

Closes #1173
@juhaku juhaku force-pushed the feature-add-map-for-service-config branch from e9ea048 to 6e37a08 Compare October 30, 2024 13:34
@juhaku juhaku merged commit 9e85e0e into master Oct 30, 2024
24 checks passed
@juhaku juhaku deleted the feature-add-map-for-service-config branch October 30, 2024 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Released
Development

Successfully merging this pull request may close these issues.

actix-web with ResourceFiles
1 participant