Skip to content

feat(request,response): add borrowed parts accessors - #868

Open
howardjohn wants to merge 1 commit into
hyperium:masterfrom
howardjohn:request/borrow-parts
Open

feat(request,response): add borrowed parts accessors#868
howardjohn wants to merge 1 commit into
hyperium:masterfrom
howardjohn:request/borrow-parts

Conversation

@howardjohn

Copy link
Copy Markdown

This adds a smaller helper to expose &Parts. Today you can only do into_parts() but requires ownership.

My main motivation is I have various helpers that require &Parts. Today this is called by something that owns req and does into_parts(); but now I have a &Request so I cannot use it. Fixing this requires duplicating the same function for Request and Parts

@seanmonstar

Copy link
Copy Markdown
Member

This has come up a few times, let me find the references... But in short, the Parts type works for into because however we store the fields in memory normally, we can always convert them into Parts. But exposing a reference would lock the layout in place.

#712
#372
#56

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants