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

Rename TypeMap to Extensions #118

Merged
merged 1 commit into from
May 10, 2020
Merged

Rename TypeMap to Extensions #118

merged 1 commit into from
May 10, 2020

Conversation

yoshuawuyts
Copy link
Member

@yoshuawuyts yoshuawuyts commented Apr 24, 2020

Implements #116. Thanks!

Screenshots

Screenshot_2020-04-24 http_types - Rust

@yoshuawuyts yoshuawuyts added this to the breaking milestone Apr 24, 2020
@Fishrock123
Copy link
Member

Fishrock123 commented Apr 27, 2020

As a newcomer, this seems more clear.

Edit: although, this seems a lot like "continuation local storage", and if it is what I think it is, users may be more familiar with that line of naming? e.g. LocalStorage?

@yoshuawuyts
Copy link
Member Author

@Fishrock123 the issue I see with the word "local" is that the question becomes: "local to what?" LocalStorage may be scoped locally to the thread, runtime, framework, request, endpoint, or middleware. Extensions is less overloaded -- at worst it may not be clear what it extends, but the assumption will always be that it extends something in the crate -- and good docs can help explain what it does.

@Fishrock123
Copy link
Member

What about ContinuationStorage then?

@yoshuawuyts
Copy link
Member Author

@Fishrock123 if, like me, you don't know what a "continuation" is in this context, that name doesn't seem very intuitive. It's also fairly long. "Extensions" is shortened in the codebase as Request::ext() and Response::ext(). In contrast smth like Request::cont_store seems less intuitive to me, but also longer.

I feel overall "extensions" is the best fit we have. With the added benefit that other crates in the Rust ecosystem use the same name for the same concept as well.

@yoshuawuyts yoshuawuyts merged commit 70bd495 into master May 10, 2020
@yoshuawuyts yoshuawuyts deleted the extensions branch May 11, 2020 07:36
@Fishrock123
Copy link
Member

A bit late, but async_std does also use the term "local storage" for tasks, and the api is "LocalKey": https://docs.rs/async-std/1.5.0/async_std/task/index.html#task-local-storage

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