-
Notifications
You must be signed in to change notification settings - Fork 511
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
Add JSON validator sample #2815
Conversation
I'd appreciate any feedback - need to present a good case for using Rust for systems programming on - and in - Windows. |
Just throwing out there, you could wire up to WinRT types in |
Also, is this a Rust 1.56 bug? https://github.com/microsoft/windows-rs/actions/runs/7632102514/job/20791559920?pr=2815 Why would a dependency in a sample break these unrelated builds? And I get the same kind of failure on the master branch when I switch to 1.56 as well:
These older versions of Cargo are quite painful. |
That error doesn't really make sense to me. The crate version definitely exists and aren't yanked. Maybe going back to old cargo corrupts the cache? Does deleting the |
Oh, this might be rust-lang/cargo#10623 tl;dr old cargo didn't understand |
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.
Looks good! I think I'd be tempted to use a type alias for the handle type. Or even a transparent new type wrapper if you don't mind explaining how this prevents accidentally mixing handle types on the Rust side of the FFI.
Speaking of handles, I'd be remiss if I didn't mention that technically speaking it should be a pointer like *mut core::ffi::c_void
or something as it is actually a real pointer to real allocated memory.
Looks like bumping MSRV to 1.60 fixed the build. Thanks Chris. |
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 much easier to read than what we have currently. Thanks @kennykerr !
Please don't. :) Use literally anything other than Not everything needed to be in the platform SDK 😞 |
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.
Looks good to me; going to skip the explicit approval to avoid chasing green ✅ here while you finish up some tweaks.
Thanks for feedback all! Here are the recent entries:
More to come... |
This sample follows on from #2814 (article) and is meant to show how you can implement a traditional Win32-style API in Rust.
This Rust implementation maps to the following hypothetical Win32-style API:
Here's the accompanying article for Getting Started with Rust.