-
Notifications
You must be signed in to change notification settings - Fork 322
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
Decide on extension trait convention #187
Comments
One possibility would be A downside is that we want to provide many extensions to |
I think using @aturon I agree with you, given that the type itself will only be present at the top of the file for the most part and the type will not be used anywhere else, the import path will give enough context as to where this is coming from. |
Edit: see updated comment below. |
Match new specification in http-rs#187
I'm in support of using the EDIT: updated comment |
@fairingrey Ignore my comment above. I completely misunderstood the convention. A more appropriate naming scheme for the extension provided by Tide's |
Oh, sorry! Yeah, that makes sense. |
As discussed in http-rs#187, context extension traits should have an import path that explains their functionality, while being named after the traits they extend. Signed-off-by: Nicholas Young <nyoung@uptime.ventures>
As discussed in http-rs#187, context extension traits should have an import path that explains their functionality, while being named after the traits they extend. Signed-off-by: Nicholas Young <nyoung@uptime.ventures>
As discussed in http-rs#187, context extension traits should have an import path that explains their functionality, while being named after the traits they extend. Signed-off-by: Nicholas Young <nyoung@uptime.ventures>
A downside of the chosen convention I recently ran into is not being able to actually bring multiple use tide::{cookies::ContextExt as _, forms::ContextExt as _}; This can also be mitigated in Tide for prelude users, if Tide has pub mod prelude {
use crate::{cookies::ContextExt as _, forms::ContextExt as _};
} then a user adding |
Having a prelude is certainly useful, and I think we eventually should have one for the most common extension traits, but not all of them would be a part of the prelude right. So we might have to rethink the naming scheme itself. |
Personally I don't mind the |
But don't you think as the ecosystem grows, the number of such imports would be an annoyance to type always. Though to be fair, most would only be typed once and then forgotten. |
A few data points:
Given the prior discussion on this thread also, I feel we should go with the schema laid out in |
One thing to keep in mind is that examples should use |
The discussion here has more or less quieted down. The futures crate is now also shadowing extension traits. It feels like we've reached consensus, and it's okay to close this now (: |
Tide uses many "extension traits" (which extend an existing type with new methods, and have no other impls). We should standardize on a naming convention.
The text was updated successfully, but these errors were encountered: