-
Notifications
You must be signed in to change notification settings - Fork 16
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
Downcast for just Send
?
#14
Comments
I'm curious as to your use-case. I imagine that this doesn't prevent you from downcasting to a concrete type that implements In the meantime, depending on your need, above, it seems that this just requires adding an intermediate: pub trait DowncastSend : Downcast + Send {
fn into_any_send(self: Box<Self>) -> Box<dyn Any + Send>;
}
impl<T: Any + Send> Downcast for T {
fn into_any_send(self: Box<Self>) -> Box<dyn Any + Send> { self }
} and possibly expanding: pub trait DowncastSync: DowncastSend + Sync {
fn into_any_sync(self: Box<Self>) -> Box<dyn Any + Send + Sync>;
...
} so that There doesn't seem to be a need to add a corresponding |
I can't link to it as it is not OSS, but I basically have some types that I may move around and then call with I did end up adding exactly what you wrote but thought that such an inclusion could be worthwhile for the library (and would finish the trifecta of wrt to downcast: It is implemented for I am not sure it is necessary to have an intermediary. While it is true that You could try adding it and running it over cargo-public-api to see what it has to say! |
Can you help me understand what you're suggesting? Where were you suggesting I should add |
So I was thinking you could just add a Lemme make a PR |
Currently one loses the
Send
bound when usinginto_any
for aBox<dyn Foo>
whereFoo: Send
.I understand that this might complicate the macro though...
The text was updated successfully, but these errors were encountered: