-
Notifications
You must be signed in to change notification settings - Fork 630
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
feat: added rust api documentation #1400
Conversation
❌ Deploy Preview for tauri-docs-starlight failed.
|
While resolving the merge I noticed a switch in folder structure from |
Yeah, that was one that we switched over recently after Tuesday's Discord call, good catch. |
A few thoughts that I have taking a quick look so far: I like the pages being split up per-module, this reflects what we have on the JS API docs. What are your thoughts on including all of a module's objects inline on the page? This is one for instance: https://deploy-preview-1400--tauri-docs-starlight.netlify.app/2/reference/rust/tauri/app/ Instead of having each of those Structs pointing to a separate page would we be able to build them out with a similar structure/order as this page for example: https://deploy-preview-1400--tauri-docs-starlight.netlify.app/2/reference/js/core/namespaceevent/ The last thing is much more cosmetic, but the typedoc generator has this bit of logic which is recently added that's really nice: https://github.com/tgreyuk/typedoc-plugin-markdown/blob/ace1b92284a6575141c3ce6d15a8fd7c3813b0e6/packages/typedoc-plugin-markdown/scripts/build-options.ts#L45 It will pick up the project's prettier config and run the files through it before writing to disk. This is sooooo nice so you don't have to fight with formatting, CI checks, etc. |
Sent a bit of pushback on Discord about making Rust more like JS, I'd want it more the other way around 😅Open to negotiation though The Prettier thing I can certainly look into 🙂 |
Putting a few notes from a side convo here: Complex: need their own page
Simple: inline on the respective module page
|
I really don't think it is worth doing this PR tbh, and I would advise against it. docs.rs is already an amazing documentation website and I am not trying to stop you re-inventing the wheel, maybe you can do a better job than docs.rs, but I just wanted to maybe stop for a moment and decide whether it is worth it or not and to also give a few points to discuss:
I am aware that this PR addresses the folks new to Rust or we want to just have a seamless integration between JS/TS and Rust docs so I would instead suggest taking the output of Again I am not really trying to discourage any efforts in this direction, just want to be sure of the direction so we don't regret it later. |
Thanks for the input @amrbashir 💜 Here's a few of my thoughts around this area (but not meant as a "yes/no" to this particular work):
Again, not a yes/no on this, I'll leave that up to @simonhyll to decide based on his time/capacity, but let's keep these points in mind especially when thinking of capacity and priority. Maybe a different way to spend this effort would be to contribute in rust-lang/rust#76578 and https://rust-lang.github.io/rfcs/2963-rustdoc-json.html to help stabilise this? I'm sure that would also help unlock the potential for other projects to jump in and build an ecosystem around Rust documentation in the future that we could use if we wanted to approach this (similar to how we see with typedoc, typedoc-plugin-markdown, typedoc-plugin-mdn, etc.) |
My time is rather limited nowadays, which to me is the bigger factor of whether this should be closed or not. The feature itself has received more than enough of a positive response to be desired to be developed one way or another, the question is just if I have the time to do it, and whether as Lorenzo says if we want to make it as a part of the tauri-docs project or if I should look into making it a completely separate project and contribute towards Rust documentation at large instead. In my opinion it doesn't hurt to keep the PR up so I can tinker with it when I have the time for it, but odds are I'll make it a separate project sooner or later anyway, so imo it's up to you @lorenzolewis if you want me keep working on this inside tauri-docs or if you want me to develop a separate project and later on PR us implementing that project in tauri-docs. |
You already hit on the point @simonhyll but my biggest thought (concern?) with this is time it takes to build and priority. At the end of the day it's OSS and the beauty of that is that anyone can work on whatever specific project their passion is in (whether docs, code, digging into Rust AST, etc.). Looking at a bit of a higher-level, this is where my head is at:
To more directly speak to your points @simonhyll:
To sum up what I'd do:
On a more personal note, I really hope that we're taking this conversation as a way to see what we need to prioritize to get Tauri to the next level, and not a conversation to rain on amazing ideas and projects. I 100% see the need for this and can see a bright future where we can make an amazing Rust API documentation thingy, but we just need to make sure we laser-focus on a few other things first. And thank you @amrbashir for keeping us grounded. Feel free to send me a message if you'd like around any of this, I'll leave it up to you to decide and do anything from here 💜 |
Closing this in favour of inbox-zero OCD and moving it to a separate project. :) |
I feel like the general consensus here is making rust approachable for new comers and be able to search it from within our site which is great, I am all for it but IMO would hurt them in the long-run if they get used to our solution because our DX will break as soon as the user needs another crate or if he even clicks on a type that is not in our crate and it will take him to docs.rs later or sooner where he will spend most of his time checking documentation for other crates anyways. I think this might be a good way to introduce users to rust but we don't have any data to decide whether it will indeed help them or not and we can't know unless we try and that's why I am not totally opposed to the idea. I am not saying docs.rs is the best but is really good IMO and far better than any language documentation I ever used and rolling our own could potentially fragment the ecosystem and I would rather see contributions upstream to help the general ecosystem by analyzing why some users hate it and how could we improve upon it (which I assume you already have an idea about). |
Adds the Rust API directly into the website!
Stream where I develop it in: https://www.youtube.com/watch?v=1M0vsXRKa9I&ab_channel=SimonHyll
The current approach requires running a custom little Rust program I made called
tauri-json
. Ideally we won't be using it for various reasons but instead make it part of our CI/CD one way or another, it can even simply be added as a part inbuild.rs
to generate the json output so we can host them in the actual repositories instead. The alternative is doing some form of Tauri CLI sort of setup for prebuilding the tool, an approach that might be more interesting if we decide to expand this to more crates than justtauri
.pnpm i -r
pnpm dev:setup
cd packages/tauri-json && cargo run
pnpm --filter rust-api-generator run build
pnpm dev
Todo:
rustdoc.index