-
Notifications
You must be signed in to change notification settings - Fork 9
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
Adding into_raw() and from_raw() methods #29
Conversation
Created a PR to continue the discussion from #28. What do you think? I considered adding tests, but I couldn't think of a meaningful way to do it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd love to see some test, even if it could be hard to find very meaningful ones. At least tests that does the following would be good:
- Sends on a channel where the
Receiver
is currently in the "raw state" and verify it can be reconstructed and the message received afterwards. - That a sender can be converted to raw and back and still successfully send a message on the channel.
0af70cd
to
df1b3a2
Compare
Updated the docs and added tests. It's a good thing you suggested that, because I forget to call |
df1b3a2
to
939f59e
Compare
Thanks for working through this one with me. I moved the test into the For what it's worth: I don't think we're actually going to need this, but I still think the functionality could be useful to someone else (and maybe us in the future). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the contribution! I'm going to merge this in its current state.
One thing I'm not 100% satisfied with is the pointer type: *mut ()
. It's completely untyped and hard to understand. Somewhat of a footgun to accidentally recreate a Sender
/Receiver
of the wrong type. I'm not sure what would be better. But I'm considering either returning *mut T
where T
is the type in the channel. I know this is wrong (but so is *mut ()
), but at least it contains type information. OR create some special public type in the library such as RawChannel<T>
and return *mut RawChannel<T>
. I'm not sure if this actually has any practical benefit at all. Most users will probably cast this to a void pointer when going through FFI anyway. Would *mut core::ffi::c_void
be better? Or is it then too C specific?
Oh yeah. I won't merge right now. The CI don't pass. You will have to look into that. |
939f59e
to
6c1b6b3
Compare
I think the CI issues should be fixed. The pointer type question is a hard one. What about making the In the end though, I think you're right that users are going to end up casting it to so maybe it doesn't matter too much. |
Awesome. Examples of this being used by std was just what I needed to be convinced. Let's keep it at
Sadly not. It's still missing on some combinations of features. You either need to use |
6c1b6b3
to
711f956
Compare
|
Not sure why the waker size tests fail. I will try to look into that in the weekend. |
Those fail for me as well when I run |
Apparently the size of the I have now pushed fixes to this to |
711f956
to
46db1ab
Compare
Sure. The tests are now passing locally for me as well. |
Thank you for the contribution! Fixing the broken CI took a few days since I temporarily did not have access to my GPG key, and I wanted to sign the commits. But now it's fixed, and your PR is merged. Hopefully this is helpful to someone :) |
Awesome, thanks for working with me on this one. |
See issue #28.