-
Notifications
You must be signed in to change notification settings - Fork 8
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
WIP Feature/nng 1.2 #18
Conversation
Glancing over it, it looks good to me. I'll double check it against Nng-rs later tonight. |
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.
This version uses nng_pipe_ev
instead of c_int
in several places, such as nng_pipe_notify
, which I think is a very good change. However, the nng_pipe_ev::try_from
function should be updated to take an nng_pipe_ev
instead of an i32
.
Other than that, it looks fine to me. If you want to merge without making the change, I won't complain.
71ba82e
to
95be805
Compare
@@ -45,6 +45,7 @@ source-update-bindings = ["build-bindgen"] | |||
cty = {version = "0.2", optional = true} | |||
|
|||
[build-dependencies] | |||
version_check = "0.1" |
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 didn't know about this crate. It seems pretty cool - I'll have to look into it for my own projects.
95be805
to
20217cf
Compare
44648d0
to
8f16b82
Compare
- Depend on default cmake behavior (see #23)
- Powershell treats writes to stderr as exceptions. Anything about crates.io goes to stderr... need to just ignore errors - https://help.appveyor.com/discussions/problems/5413-calling-external-executable-causes-nativecommanderror-despite-no-apparent-error
Let me know when this is ready to go live and I'll take a look / push it to Crates.io. |
Should be pretty close. Go ahead and take a look. |
Looks good to me. I'll push it when you say it's ready. EDIT: And after it is merged into master. |
} | ||
} | ||
} | ||
|
||
impl nng_pipe_ev { |
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.
This enum doesn't match the others with try_convert_from
and TryFrom
implementation. It's small enough to not really matter, though.
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.
If I remember correctly, those were just a temporary solution before TryFrom
was stabilized, and nng_pipe_ev
didn't exist then. Once we no longer care about Rust <1.34 we can just remove try_convert_from
. Doesn't make sense to make them deprecated since there isn't a replacement for earlier rust.
arg2: ::std::os::raw::c_int, | ||
arg3: *mut ::std::os::raw::c_void, | ||
), | ||
unsafe extern "C" fn(arg1: nng_pipe, arg2: nng_pipe_ev, arg3: *mut ::core::ffi::c_void), |
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.
This is a source of potential UB that the Rust wrappers can't guard against. C does not enforce that the nng_pipe_ev
will be one of the allowed values and it is UB in Rust to not be a variant. It may be best to change the Bindgen settings to not use actual enums for the NNG enum types.
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.
To be clear, I think having C enums as argument is good (Rust will enforce valid variants) but anywhere an enum is received is immediately potentially UB. See the Rust language reference. Using repr(u*)
instead of repr(C)
does not alleviate the issue.
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.
Sure, let's switch them.
- Mixing of C and Rust enums is potentially undefined - rustfmt
b096d66
to
62b7a54
Compare
@neachdainn Merge? |
I'm having issues building this. I'll figure out why and then report back. |
The issue seems to be with the
It appears to be fixed on the NNG master branch. So we can either remove the |
Yes, apparently it's broken in 1.2.3. There's no sense in removing |
That sounds reasonable to me. You have my support to do the merge whenever you're ready. |
Fixes for nng master@HEAD what will become v1.2