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

Support using SendMap for Extensible #14

Open
MJDSys opened this issue Feb 27, 2017 · 1 comment
Open

Support using SendMap for Extensible #14

MJDSys opened this issue Feb 27, 2017 · 1 comment

Comments

@MJDSys
Copy link

MJDSys commented Feb 27, 2017

Hi all,

I'm trying to get Iron ported over to Hyper's master branch, which is based on tokio (PR iron/iron#523). My current attempt requires that the Iron::Response type is Send. However, because Response contains a TypeMap, the compiler won't typecheck. I tried changing it to a SendMap, which then failed as Response implements Extensible from this crate which only supports TypeMap.

I tried generalizing Extensible (and thus the methods of Pluggable) over the trait passed to TypeMap, however the compiler was then unhappy as I couldn't convince it that Plugin::Value implemented typemap::internals::Implements as I can't directly specify that restriction due to typemap::internals being private. I tried making a shadow of typemap::internals::Implements, but it seems the compiler isn't smart enough to realize my shadow meant Implements had to be implemented.

I'm not sure how to proceed at this point. Do you have any suggestions? Would exposing Implements from typemap be ok?

@reem
Copy link
Owner

reem commented Feb 27, 2017

This is a very interesting question!

I don't think there is any strong reason not to export Implements from typemap as it is already an unsafe trait but that code is complex and I have not worked on it for a long time, so I am hesitating.

I suggest proceeding with a local fork of typemap which has Implements exported and seeing if that would actually solve the problem. If it does and I can't come up with any reason it's not safe to export in the interim we can export it officially.

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

No branches or pull requests

2 participants