-
Notifications
You must be signed in to change notification settings - Fork 7
Basic winmd parsing support #1
Conversation
This reverts commit b1fb941.
use std::io::Result; | ||
use std::vec::*; | ||
|
||
// TODO: what about using std::io::Read? |
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.
You might be interested in checking out byteorder: https://docs.rs/byteorder/1.3.2/byteorder/
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'm trying to keep dependencies to a minimum and only those that are absolutely essential. For example, I suspect I'll need a dependency on the syn
crate for the WinRT projection. 😉
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.
That's fair. I'd still suggest taking a look to see if you can steal some ideas ;-)
let db = Database::new(filename)?; | ||
for t in db.type_def().iter::<TypeDef>() { | ||
if t.flags()?.windows_runtime() { | ||
let types = namespaces.entry(t.namespace()?.to_string()).or_insert_with(|| NamespaceData { ..Default::default() }); |
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.
Why not derive Default for NamespaceData
?
Going to stop there. That's (more than) enough for one PR but provides a good starting point for subsequent work. Lots more to do though. We'll address the remaining open issues in this PR separately. @rylev, thanks for all the feedback! |
This is certainly not done but I'd love some early feedback so I'm putting it out for review. The idea is to provide a winmd reader, similar in spirit to the C++ winmd library used by C++/WinRT, that is natural and familiar to Rust developers. This will be the primary dependency of the Rust/WinRT projection and provide just-in-time projection of WinRT APIs into Rust.
Things that are mostly done:
Things that need more work: