I've been thinking it would be nice if I could explore my dependencies with some sort of query language like SQL instead of browsing through the website generated by rustdoc. I generally find it faster to type out a question than to click through links. Sometimes I also have specific questions that I'm not sure there's a way to answer from rustdoc websites. For example, "Given T, what types implement From<T>
?" I don't have an example of what such a query would look like, because I'm not sure how this system would work and I don't know SQL yet, but hopefully you have an idea of what I'm talking about?
So my first question is, has anyone done something like this before? I think the answer is no because I can't find any information about something like this online. So my second question is how could we go about building a system like this? rustdoc
has this -w json
option (which can be used with cargo by doing something like RUSTDOCFLAGS='-wjson -Zunstable-options' cargo +nightly doc
) which produces a sort of json schema of all the items in your crate (and in all of your dependencies when used with cargo). Then I imagine we would want to preprocess this json, maybe reorganizing it in the way that makes the most sense to the programmer, and maybe merging the output for different crates so you can query them all at once. Then we would want to give the programmer a way to query it. For example, we could translate the json schema into a sqlite database. Or maybe we could query the json directly. I don't really know what graphql is, but it looks like json, maybe we could use that?
Anyways, I'm just spitballing ideas here. Is anyone else interested in something like this? Does anyone with more experience with query languages than me have some thoughts on this?