Rust-for-Linux / linux

Adding support for the Rust language to the Linux kernel.
https://rust-for-linux.com
Other
3.98k stars 429 forks source link

docs: consider whether to distinguish kernel-only `alloc` methods #407

Closed ojeda closed 1 month ago

ojeda commented 3 years ago

From https://github.com/Rust-for-Linux/linux/pull/402#discussion_r661030419:

The main reason I think the current way is not acceptable is that when we generate the docs for the alloc crate, people may look at the doc and think that it is part of standard Rust library but clearly it isn't.

From https://github.com/Rust-for-Linux/linux/pull/402#discussion_r661528647:

I replaced the Rust logo with the Rust for Linux one (in the version we sent for the RFC) so that it was clear when the user is navigating from the kernel docs into the Rust ones (e.g. when clicking on Some).

Having also a banner on the specific methods that are kernel-only would also be nice to further clarify

If we want something extra to the logo, e.g. to highlight individual methods, perhaps we can go with some unique to the kernel so that it is even more obvious, e.g. changing slightly the background color or a colored line in the right or left, etc.

frazar commented 1 month ago

Not sure if this Issue is still relevant, but for what it's worth, it is possible to inject arbitrary HTML in rustdocs simply by placing it in the doc comments:

ojeda commented 1 month ago

I think with alloc being custom soon, we can close this.

Injecting some custom HTML is an interesting idea @frazar, although I guess we would have wanted to do it somehow automatically, i.e. without having to write it all the time the same CSS styling and possibly automating the injection too (by looking at the "kernel" annotation we had).