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

Feature/add downcast send #16

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

TheNeikos
Copy link
Contributor

Closes #14

Signed-off-by: Marcel Müller <neikos@neikos.email>
Signed-off-by: Marcel Müller <neikos@neikos.email>
README.md Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
@@ -194,6 +194,16 @@ impl<T: Any> Downcast for T {
fn as_any_mut(&mut self) -> &mut dyn Any { self }
}

pub trait DowncastSend: Downcast + Send {
fn into_any_send(self: Box<Self>) -> Box<dyn Any + Send>;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels a little less elegant that

  1. This method is not supported for DowncastSync given that it also includes Downcast + Send in its constraints.
  2. We're not supporting into_any_sync. Do you anticipate no need for this?

I suppose we could publish the current change that you've written and then conceivably do both of the above changes and then publish a 2.0 version. I'm not sure how much that's worth it. Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! In my mind if you wanted a Box<dyn Any + Send> you'd just use DowncastSend and not expect DowncastSync to provide it for you, but I can get why this might be wanted.

I'll investigate if adding the supertrait is a breaking change at all

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.

Downcast for just Send?
2 participants