-
Notifications
You must be signed in to change notification settings - Fork 321
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
Split state into a separate parameter #715
Open
yoshuawuyts
wants to merge
19
commits into
main
Choose a base branch
from
split-state
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fix a broken documentation link that should point to `serde_qs` so that users do not have to search themselves.
This should help demystify some cases when client errors are determined by parsing and propagated via `?`.
This should help the default logger be as helpful as possible.
Removes outdated parts of our .github dir that were accidentally added back a few months ago. This removes: - DCO notices - issue templates - PR templates
It now is only installed via the `logger` feature. In order to do this we need the `std` feature from `log` crate.
… loop I also added a test for this that shows it now works. thanks to Hasali19 for noticing this
The rc_buffer thing is similar to http-rs/surf#242
yoshuawuyts
force-pushed
the
split-state
branch
from
October 15, 2021 12:32
79ea8df
to
9bdd50b
Compare
What's the state (heh) of this PR? Having the state as a separate arg does seem to be a better interface to me so no opposition here, but it would be nice to either close or land this. The local/global states would be excellent too (I assume you meant request-local state). |
This and #895 seem mutually exclusive, and #895 seems like a cleaner approach. What do you think, @yoshuawuyts? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR changes the relationship between request and state. Instead of embedding request and state into the same type, it makes them two separate arguments. So
req: Request<State>
becomesreq: Request, state: State
. The idea behind this is that for smaller applications that are only parameterized by a single type calling that type "state" feel somewhat indirect.Take for example this MongoDB example:
req.state()
feels like an odd indirection to get to the parameterized type. Instead if the type was a direct input to the function it'd be easier to name and use:This also makes it easier to convert from
http_types::Request
totide::Request
since theState
param does not need to be populated. I don't think this functionally changes much about Tide; except that in some cases it'll just feel that little bit smoother.