Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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
@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

2 participants