Make web::Path innards public#3588
Conversation
So we can do something like this:
```
async fn delete_channel_message(
web::Path((channel_id, message_id)): web::Path<(Snowflake, Snowflake)>,
) {
// here channel_id and message_id are Snowflakes,
// and not web::Path<Snowflake>
}
```
Dunno why other web types are public and this is not.
|
This field was made private for v4.0 but later it was realized this was the wrong trade-off. Making it public again is certainly planned for v5.0. This is a breaking change due to the Deref impl, so it should also be removed in this PR. For now, you can use the Path type from actix-web-lab to get destructuring. |
Could you elaborate please? |
|
The thing we were seeing in v3.x was users reporting confusion using this type without destructuring because the Deref impl allowed access to tuple elements like |
|
Okey, I get it. |
|
No rush. Like I say, this will need to wait for v5.0. |
@robjtede: Deref impl [with public Path contents] allowed access to tuple elements like path.1 but then path.0.1 also worked so it was weird.
PR Type
Other?
PR Checklist
Documentation comments have been added / updatedOverview
This change allows us to do something like this:
Dunno why other web types are public and this is not.