-
-
Notifications
You must be signed in to change notification settings - Fork 392
Add wave* and some time* functions #107
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
Conversation
pub const WAVERR_LASTERROR: MMRESULT = WAVERR_BASE + 3; | ||
#[repr(C)] #[derive(Clone, Copy, Debug)] | ||
pub struct HWAVEIN__; | ||
pub type HWAVEIN = *mut HWAVEIN__; |
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.
Use DECLARE_HANDLE!(HWAVEIN, HWAVEIN__);
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.
Fixed HWAVEIN
and HWAVEOUT
.
I'm not sure how I want to deal with untagged unions. Ideally Rust would get something like rust-lang/rfcs#724 which would makes things way easier. I'm not a fan of those methods returning a |
336205f
to
a597829
Compare
Yeah, I wish there were language support for C unions. What do you think about having pub unsafe fn ms<'a>(&'a self) -> &'a ::DWORD {
::std::mem::transmute(&self.data)
}
pub unsafe fn ms_mut<'a>(&'a mut self) -> &'a mut ::DWORD {
::std::mem::transmute(&mut self.data)
} The methods should probably have an |
There shouldn't be any need to explicitly specify the lifetime in this case as lifetime inference should be enough. Otherwise that approach should work. |
a597829
to
6679dc0
Compare
Right, thanks. I was thinking that |
6679dc0
to
1c0077c
Compare
Do you think you could update this PR to try to make use of the |
1c0077c
to
4112ad1
Compare
Sure, it's updated. I think using a macro is a good improvement. |
Is this a good way to do unions (
MMTIME
)? It is similar to how bindgen translated the union.